optimized edge creation