Constructing Long Paths in Graph Streams
Abstract
In the graph stream model of computation, an algorithm processes the edges of an -vertex input graph in one or more sequential passes while using a memory that is sublinear in the input size. The streaming model poses significant challenges for algorithmically constructing long paths. Many known algorithms that are tasked with extending an existing path as a subroutine require an entire pass over the input to add a single additional edge. This raises a fundamental question: Are multiple passes inherently necessary to construct paths of non-trivial lengths, or can a single pass suffice? To address this question, we systematically study the Longest Path problem in the one-pass streaming model. In this problem, given a desired approximation factor , the objective is to compute a path of length at least , where is the length of a longest path in the input graph .
We study the problem in the insertion-only and the insertion-deletion streaming models, and we give algorithms as well as space lower bounds for both undirected and directed graphs. Our results are:
-
1.
We show that for undirected graphs, in both the insertion-only and the insertion-deletion models, there are semi-streaming algorithms, i.e., algorithms that use space , that compute a path of length at least with high probability, where is the average degree of the input graph. These algorithms can also yield an -approximation to Longest Path using space .
-
2.
Next, we show that such a result cannot be achieved for directed graphs, even in the insertion-only model. We show that computing a -approximation to Longest Path in directed graphs in the insertion-only model requires space . This result is in line with recent results that demonstrate that processing directed graphs is often significantly harder than undirected graphs in the streaming model.
-
3.
We further complement our results with two additional lower bounds. First, we show that semi-streaming space is insufficient for small constant factor approximations to Longest Path for undirected graphs in the insertion-only model. Last, in undirected graphs in the insertion-deletion model, we show that computing an -approximation requires space .
Keywords and phrases:
Longest Path Problem, Streaming Algorithms, One-way Two-party Communication ComplexityFunding:
Christian Konrad: Supported by EPSRC New Investigator Award EP/V010611/1.Copyright and License:
2012 ACM Subject Classification:
Theory of computation Streaming models ; Mathematics of computing Paths and connectivity problemsEditors:
Anne Benoit, Haim Kaplan, Sebastian Wild, and Grzegorz HermanSeries and Publisher:
Leibniz International Proceedings in Informatics, Schloss Dagstuhl – Leibniz-Zentrum für Informatik
1 Introduction
In the graph stream model of computation, an algorithm processes a stream of edge insertions and deletions that make up an -vertex input graph via one or multiple sequential passes. The primary objective is to design algorithms that use as little space as possible. The most studied and best-understood setting is the one-pass insertion-only setting, where only a single pass is allowed and the input stream does not contain any edge deletions. It is known that many fundamental problems can be solved well in this setting, e.g., there are semi-streaming algorithms, i.e., algorithms that use space 111We write to mean the usual Big- notation with poly-logarithmic dependencies suppressed. and are defined similarly., for computing a spanning tree and a maximal matching [16], while no space algorithms exist for other problems such as computing a maximal independent set or a BFS/DFS tree [14, 6]. For such problems, algorithms that make multiple passes over the input data are typically considered [24, 13, 1, 9, 4].
Our work is motivated by the observation that streaming algorithms that construct long paths, often as a subroutine, require a large number of passes. For example, many streaming algorithms for computing large matchings construct augmenting paths as a subroutine (e.g., [29, 28, 30]), and these algorithms typically only add a single edge or a few edges per pass to a not-yet-completed augmenting path. Another example is streaming algorithms for computing BFS/DFS trees that extend partial trees/paths by adding only a single edge per pass [24, 13]. This raises a fundamental question: Is the one/few-edges-per-pass strategy best possible and multiple passes are inherently necessary to construct paths of non-trivial lengths, or can a single pass suffice?
The Longest Path Problem.
We address this question by systematically studying the Longest Path (LP) problem in the one-pass streaming setting. In this problem, the objective is to compute a path of length , where denotes the length of a longest path in the input graph , and is the approximation factor.
In the offline setting, in undirected graphs, it is known that it is NP-hard to compute a constant factor approximation to Longest Path [23] (see the same paper for stronger impossibility results that are based on other hardness conjectures). In directed graphs, a much stronger hardness result is known. Björklund, Husfeldt and Khanna [11] showed that it is NP-hard to approximate LP in directed graphs within a factor of , for any . Regarding upper bounds, it is known that a path of length can be constructed greedily in polynomial time, where is the min-degree of the input graph [23]. There are also FPT algorithms with runtime polynomial in but exponential in the length of the path constructed (see, for example, [10] and the references therein). We note that streaming algorithms for the LP problem have also previously received attention, however, only from a practical perspective. Kliemann et al. [25] studied practical multi-pass algorithms without providing any theoretical guarantees.
1.1 Our Results
In this work, we give one-pass streaming algorithms and space lower bounds for undirected graphs as well as a strong space lower bound for directed graphs. We consider both the insertion-only model (no deletions) and the insertion-deletion model (deletions allowed).
As our first result, we show that, in undirected graphs, if we sample random edges from the input graph, then this sample contains a path of length with high probability, where is the average degree of the input graph. Since this sampling task can be implemented in both the insertion-only and the insertion-deletion streaming models using standard techniques, we obtain the following theorem:
Theorem 1.
In both the insertion-only and the insertion-deletion models, for undirected graphs, there are space algorithms that compute a path of length at least with high probability, where is the average degree of the input graph.
We remark that our algorithm can be used to obtain an -approximation to LP using space, for any . This is achieved by running our algorithm in parallel with the trivial algorithm that stores edges. Then, if the space constraint of is large enough to store the entire graph then we can find an exact solution in exponential time. If not, then we are guaranteed that the average degree of the input graph is , which implies that the algorithm of Theorem 1 yields the desired result. We thus obtain the following corollary:
Corollary 2.
In both insertion-only and insertion-deletion models, for undirected graphs, there are -space streaming algorithms for an -approximation to Longest Path.
Next, we ask whether a similar algorithmic result is possible in directed graphs. As our main and most technical result, we show that this is not the case in a strong sense:
Theorem 3.
Every one-pass streaming algorithm for Longest Path in the insertion-only model in directed graphs with approximation factor requires space .
Theorem 3 together with Corollary 2 establishes a separation in the space complexity between algorithms for undirected and directed graphs for LP in the insertion-only model. This lower bound is also in line with recent results for directed graphs that demonstrate that problems on general directed graphs are often hard to solve in the streaming model [12].
Finally, we complement our results with two additional lower bounds. First, we give a lower bound for insertion-only streams and undirected graphs, ruling out the existence of semi-streaming algorithms with constant approximation factor close to .
Theorem 4.
Every one-pass insertion-only streaming algorithm for Longest Path on undirected graphs with approximation factor , for any , requires space .
We note that this lower bound result is significantly weaker than our lower bound for directed graphs, both in terms of approximation factor and space. This, however, is in line with the status of the problem in the offline setting, where a very strong impossibility result for directed graphs is known, but only significantly weaker impossibility results for undirected graphs exist. While the offline setting is orthogonal to the streaming setting, one cannot help but wonder whether similar mechanisms are at work that prevent us from obtaining stronger NP-hardness results for LP approximation in undirected graphs and from obtaining stronger space lower bounds in the streaming setting.
Last, we show that, in insertion-deletion streams, space is required for an -approximation of LP.
Theorem 5.
Every one-pass insertion-deletion streaming algorithm for Longest Path on undirected graphs with approximation factor requires space .
This lower bound together with our algorithm show that the optimal dependency of the space complexity on in insertion-deletion streams is between and .
1.2 Our Techniques
Algorithm.
We will first explain the key ideas behind our algorithm. As observed by Karger et al. [23], a path of length , where is the minimum degree of the input graph , can be computed as follows: Start at any vertex and visit an arbitrary neighbor that we denote by . In a general step , we have already constructed the path . We then visit a neighbor of that has not previously been visited. Then, as long as , we can always find a yet unvisited neighbor, and, hence, we obtain a path of length . We first see that this argument can also be applied to the average degree of the graph . It is well known that, by repeatedly removing vertices of degree at most from until no such vertex remains, we are left with a non-empty graph with min-degree at least . We can now apply the same argument as above to and thus find a path of length at least .
The approach outlined above, however, does not yield a small space streaming algorithm since a) we do not know which vertices are contained in , and b) we cannot afford to store incident edges on each vertex. To overcome these obstacles, we resort to randomization. Our algorithm solely samples random edges from the input graph and outputs a longest path among the edges . To see that a long path in exists, we argue that the subset of edges that are also contained in contains a path of length at least with high probability. Such a path can be constructed greedily. Suppose we have already constructed a partial path of length solely using the edges , and let denote its current endpoint. Then, since has a degree of at least in , there are at least neighbors of in that have not yet been visited in the path. Since we sample edges overall, the probability that any one of these edges incident to that connect to these vertices is sampled is , which implies that at least one of these edges is sampled with high probability and we can extend the path.
Space Lower Bounds.
All our space lower bounds are proved in the one-way two-party communication setting. In this setting, two parties that we denote by Alice and Bob each hold a subset of the edges of the input graph , with being Alice’s edges, and being Bob’s edges. Alice sends a single messages to Bob, and Bob computes the output of the protocol. Then, it is well-known that a lower bound on the size of the message also constitutes a lower bound on the space of any one-pass streaming algorithm.
We work with induced matchings in all our lower bound constructions. In a graph , a matching is induced if the edges of the vertex-induced subgraph are precisely the edges of . Suppose now that is bipartite, and we denote it by . Furthermore, we suppose that Alice’s subgraph, i.e., the graph spanned by the edges , contains a matching that is induced in the final graph. We say that is the special matching. We complete our lower bound constructions so that:
-
1.
Every long path in the graph must contain many edges of the special matching ;
-
2.
The special matching is hidden among the edge set so that Alice cannot identify , and, given a limited communication budget, Alice therefore cannot forward many of ’s edges to Bob.
The two properties then imply a lower bound since, if Bob knows only few edges of , but every long path contains many such edges, then Bob cannot output a long path.
To achieve property , in our insertion-deletion lower bound, we make use of edge deletions as part of Bob’s input to turn a large matching in into an induced matching, and in our insertion-only lower bounds, we work with Rusza-Szemerédi graphs (RS-graphs in short), which have been extensively used for proving lower bounds for matching problems in the streaming setting (e.g., [18, 8, 26, 27]). An -RS-graph is a balanced bipartite graph on vertices such that its edge set can be partitioned into induced matchings , each of size . Our insertion-only constructions are such that each of these matchings can take the role of the special matching , which will allow us to argue that Alice essentially has to send many edges of each induced matching to Bob if Bob is to report a long path. We note that the framework of working with RS-graphs and a special hidden matching among Alice’s edges is well-established and has previously been used, for example, in [18, 7, 3, 27, 5, 4].
Regarding establishing property , we pursue different strategies that depend on the specific streaming setting, and on whether we work with directed or undirected graphs. These strategies are described below and illustrated in Figure 1.
Directed Graphs: Since constitutes the only edges directed from right to left, and is an induced matching, up to potentially the first and last edge, every long path alternates between edges of and and thus contains many edges of .
Undirected Graphs: (Insertion-Only) The path is connected to a longest path in . Our argument is based on the fact that it is detrimental to the length of the output path to include many edges between and . Indeed, suppose that the output path contains the two red edges incident on vertex . Then, the vertices highlighted in red cannot be visited by the output path. This allows us to argue that, for each edge going across the cut , multiple vertices on the path are not visited. This in turn implies that every long path must contain many edges of in order to visit the vertices in .
Insertion-Deletion Streams: (Undirected Graphs) Our construction is such that there are only vertices outside . Hence, if Bob does not know many edges of then there are at most vertices of available to connect to vertices within . Since this number is small, Bob is required to learn many edges of in order to output a long path.
Directed Graphs in the Insertion-only Model. The cleanest case is our lower bound for directed graphs. In this setting, Alice holds the edges of an RS-graph , and we assume that all edges are directed from to . We then pick a matching , for a uniform random , and Bob inserts a random matching that matches to so that all edges in are directed from to . We then leverage the well-known result that the expected length of a longest cycle in a random permutation of the set is of length [20, 19] in order to argue that contains a path of expected length . It then remains to argue that every path of length , for any , in the input graph must contain edges of , which uses the fact that the matching is induced. Since, however, Alice did not know that is the special matching, Alice is required to send a large number of edges of each induced matching to Bob so that Bob can output a long path.
For technical reasons, our graph construction is slightly more involved than described above since we need to turn Alice’s RS-graph into an input distribution, see Section 4 for details. While it is easy to argue that if Alice sends edges of to Bob then Bob can compute a path of length at most in , we need to argue a much stronger bound. We show that, even if Alice sends as many as edges to Bob then Bob can still only find a path of size in . We implement our approach using the information complexity paradigm, including direct sum and message compression arguments.
Undirected Graphs in the Insertion-only Model. In our construction for undirected graphs, Alice holds an RS-graph , and, given a random index , Bob holds a random matching matching to . Similar as above, the matchings contain a path of length . However, it is no longer true that any long path in must contain many edges of as, for example, the vertices in can now be used to visit the vertices within as their incident edges are undirected.
Our aim is to ensure that it is detrimental for constructing long paths to include many edges across the cut in the path. Once this property is established, we will argue that, if Bob only knows few of the edges then many vertices of will remain unvisited in the output path, which implies that the path is bounded in length as not all vertices are visited. To argue that only few edges across the cut are included in the output path, we ensure that all the vertices serve as gateways to other parts of the graph that are introduced by Bob. The construction is so that these other parts cannot be visited if connects to a vertex in in the output path, which will then be detrimental for the construction of a long path. To achieve this, Bob introduces additional edges as follows. First, let be a path consisting of novel edges that visits every vertex in , and let be the path obtained from by subdividing every edge in , times, for some integer . Furthermore, this path is connected to the longest path within . Then, the path significantly contributes to the longest path in the input graph. Observe, however, if a vertex connects to a vertex in then the vertices on the subdivision on one of the edges of incident on cannot be visited anymore. By setting large enough, we show that it is detrimental for the algorithm to use such vertices to connect to , which renders the edges of indispensable for a long path. As above, the actual lower bound construction is more involved since we need to turn Alice’s RS-graph into an input distribution. On a technical level, we give a reduction to the two-party communication problem Index using ideas similar to those introduced by Dark and Konrad [15].
Undirected Graphs in the Insertion-deletion Model. The key advantage that allows us to prove a much stronger lower bound for insertion-deletion streams than for insertion-only streams is that Bob can insert edge deletions that turn a large matching contained in Alice’s edges into an induced matching. We see that it is possible to achieve this so that:
-
1.
The special (induced) matching is of size ; and
-
2.
The special matching is hidden among Alice’s edges.
Furthermore, we make sure that there exists a second matching such that forms a path of length . Property 1 significantly helps in proving our lower bound since, as opposed to our lower bound for undirected graphs in insertion-only streams, there are only vertices outside the set , and, hence, these vertices only allow us to visit vertices of . We can then argue that, for the remaining vertices of , Bob is required to know the edges of for those to be visited. This however requires Alice to send these edges to Bob. Then, Property 2 ensures that Alice cannot identify these edges and would therefore have to send most edges of the input graph to Bob, which exceeds the allowed communication budget. On a technical level, we give a reduction to the Augmented-Index two-party communication problem, again, reusing many of the ideas given in the lower bound by Dark and Konrad [15].
1.3 Outline
We provide notation, state RS-graph constructions, introduce the information complexity framework, state important inequalities involving mutual information, and give a message compression theorem in our preliminaries section, Section 2. Then, we present our algorithm in Section 3, and our lower bound for directed graphs in insertion-only streams is given in Section 4. Due to space restrictions, our lower bound for undirected graphs in insertion-only streams and our lower bound for undirected graphs in insertion-deletion streams are deferred to the full version of this paper. We conclude in Section 5 with open problems.
2 Preliminaries
Given a graph , for vertices , we denote an undirected edge between and by , and a directed edge with tail and head by .
2.1 Rusza-Szemerédi Graphs
In our lower bounds, we make use of Rusza-Szemerédi graphs.
Definition 6 (Rusza-Szemerédi Graph).
A bipartite graph is an -Ruzsa-Szemerédi graph, -RS graph for short, if its edge set can be partitioned into induced matchings, each of size .
2.2 Streaming Models
Given an input graph , an insertion-only stream describing is an arbitrarily ordered sequence of the edge set . An insertion-deletion stream is a sequence of edge insertions and deletions so that, at the end of the stream, the surviving edges constitute the edge set . Furthermore, the stream is such that only edges that have previously been inserted are deleted, i.e., the multiplicity of an edge is never negative. We also assume that at any moment the multiplicity of any edge is polynomially bounded. This standard assumption ensures that sampling methods such as -sampling require only space.
2.3 Communication Complexity
We consider the one-way two-party model of communication for proving our space lower bounds. In this setting, two parties, denoted Alice and Bob, share the input data so that Alice holds and Bob holds . They operate as specified in a protocol in order to solve a problem . Alice and Bob can make use of both private and public randomness. Randomness is provided via infinite sequences of uniform random bits. Private randomness can only be accessed by one party. The sequence of public randomness can be accessed by both Alice and Bob, and we denote this sequence by .
The protocol instructs the parties to operate as follows. First, Alice computes a message that we (ambiguously) also denote by as a function of , , and her private randomness, sends the message to Bob, who then computes the output of the protocol as a function of and his private randomness. The communication cost of a protocol is the maximum length of the message sent by Alice in any execution of . The communication complexity of a problem is the minimum communication cost of any protocol that solves .
2.4 Information Complexity and Message Compression
We prove lower bounds using the information complexity paradigm, which is a framework that is based on information theory. Let be jointly distributed random variables according to distribution . We denote the Shannon entropy of by , the entropy of conditioned on by , the mutual information of and by , and the conditional mutual information between and conditioned on by . We may drop the subscript in and if it is clear from the context.
We will use the following standard facts about entropy and mutual information: (let be jointly distributed random variables.)
-
P1:
If and are independent conditioned on then:
-
P2:
-
P3:
Let be an event independent of . Then:
-
P4:
Given a one-way two-party communication protocol and an input distribution , we will measure the amount of information that the message reveals about Alice’s input under distribution . The following quantity is denoted the external information cost of :
Definition 8.
The (external) information cost of the one-way two-party communication protocol under input distribution is defined as:
Then, for a given problem , we denote the information complexity of under distribution as the minimum information cost of a protocol that solves .
It is well-known that information cost of a protocol lower bounds its communication cost.
We will also use a message compression result, which is due to Harsha et al. [21]. We follow the presentation of this result given in [31].
Theorem 9 (Message Compression).
Let be a protocol in the one-way two-party communication setting. Then, the protocol can be simulated with a different protocol that sends a message of expected size at most
3 Algorithm
We will first describe and analyze our sampling-based algorithm in Subsection 3.1, and then discuss implementations of this algorithm in streaming models in Subsection 3.2.
3.1 Sampling-based Algorithm
Let be the input graph with , , and average degree . Consider the following algorithm:
We show that Algorithm 1 constructs a path of length at least with high probability.
Theorem 10.
Algorithm 1 constructs a path of length with probability at least . It can also be regarded as an -approximation algorithm for Longest Path.
Proof.
Given the input graph , let denote a subset of vertices of such that has minimum degree at least . It is well-known that such a subset of vertices exists (see Lemma 19 for completeness).
Let be any vertex, and let be the path of length with start and end point . We will extend using the edges in that are also contained in , as follows:
In step , we add the edge to and obtain the path . The edge is an arbitrary edge in incident on that connects to a vertex that has not yet been visited on the path . We will now prove that such a vertex exists.
First, recall that, by definition of , the vertex has at least neighbors in . Since , at least of these neighbors are not visited by the path . Denote by this set of at least edges connecting to not yet visited neighbors in . We now claim that at least one of the edges of is contained in with high probability. Observe that at stage , we have only learnt so far that the sample contains the edges of the path . Hence,
where we used the inequality (see Lemma 18) to obtain the first inequality and the bound to obtain the second.
We can therefore extend the path with probability at any step . Since we run steps overall to create the final path of length , by the union bound, we succeed with probability at least . Last, since a longest path in is of length at most , the algorithm also constitutes an -approximation algorithm to Longest Path.
3.2 Implementation in Streaming Models
Algorithm 1 can easily be implemented in both the insertion-only and the insertion-deletion streaming models. In the insertion-only model, a uniform sample of the edges in the stream can be obtained using reservoir sampling [32], and, in the insertion-deletion model, this can be achieved using -samplers [22] and rejection sampling. We obtain our main theorem:
Theorem 1.
In both the insertion-only and the insertion-deletion models, for undirected graphs, there are semi-streaming algorithms that compute a path of length at least with high probability, where is the average degree of the input graph.
4 Insertion-only Lower Bound for Directed Graphs
In this section, we prove an space lower bound for one-pass streaming algorithms for LP on directed graphs that compute an -approximation. To this end, we work with two input distributions (Simple Longest Path) and (Longest Path). In Subsection 4.1, we give a lower bound on the information cost of protocols that solve well. We achieve this by, first, proving a lower bound on the communication cost of any protocol that solves directly via combinatorial arguments, and then employ a message compression argument that allows us to conclude that the information cost of such protocols must also be large. Then, in Subsection 4.2, we present the distribution , which makes use of an -RS-graph, and we establish a direct sum argument, showing that the information cost of protocols that solve is at least times the information cost of protocols that solve , which bounds the information cost of protocols that solve from below. Then, since information cost is a lower bound on communication cost, we obtain our result.
4.1 A Simple Distribution
We will first work with the distribution denoted , see Figure 2.
Input Distribution :
The directed graph with , , , , and , where are Alice’s edges and are Bob’s edges, is obtained as follows:
Alice’s Input: Edge set
For each , flip an unbiased coin and if it comes out heads then insert the directed edge into the graph. If it comes out tail then insert the edge . Observe that this constitutes a directed matching that matches all -vertices and exactly one of , for all .
Alice holds the edges .
Bob’s Input: Edge set
Let be a uniform random matching between and , directed from towards . Let be a copy of , but every -vertex is replaced by the corresponding -vertex.
Bob holds the edges .
We first argue that the expected length of a longest path in is .
Lemma 11.
The expected length of a longest path in is bounded as follows:
where is the Golomb-Dickman constant.
Proof.
For an input graph with and , let be the graph obtained from by contracting the vertex pairs and , for all , and by treating parallel edges in the resulting graph as single edges, see Figure 3 for an illustration. It is easy to see that . Furthermore, denote by the distribution of . Observe that and are uniform distributions over their respective supports.
Next, consider the set of permutations of the set . Consider now the bijection , where a permutation is mapped to the graph that contains the edges , for all . Then, we observe that, for a permutation , the length of the longest cycle is related to as follows:
It is known that the expected length of a longest cycle in a random permutation is at least , where is the Golomb-Dickman constant [20, 19]. Hence, we obtain
using the assumption that is large enough. Since the longest paths in and are identical, the result follows.
Next, we show that any deterministic protocol on distribution that communicates at most bits outputs a path of length with high probability over .
Lemma 12.
Let be a deterministic one-way communication protocol for Longest Path on distribution that communicates at most bits. Then, the probability over the input distribution that outputs a path of length is at least .
Proof.
Denote by the set of possible directed input matchings for Alice in . Then, . Next, since every message sent by protocol is of length at most , there are at most different messages. On average, a message therefore corresponds to inputs, and, at most inputs yield messages that in turn only correspond to at most inputs. Hence, at least inputs yield messages that each correspond to at least inputs. Consider now one of these messages , and let be the matchings that correspond to . Given , the protocol can only output an edge if it is contained in all matchings . Suppose that there are such edges. Then, there are at most input graphs that contain these edges. We then have:
which implies .
Denote by this set of at most edges. We will now prove that the longest path in is of length with high probability.
Denote by the -endpoints of the edges , and let be any vertex. We bound the length of the path with starting point . This path first uses the edge in incident on , and denote by the other endpoint of this edge. Then, the path uses the edge of or incident on to return to an -vertex that we denote by . Observe that we can only continue on this path if . If this is the case then we can continue in the same fashion, visit a -vertex , and return to another -vertex . Again, we can only continue if , and so on. For any , the following holds:
assuming that is large enough. Hence, the probability that the path contains -vertices and is thus of length is at most . This further implies that, with probability at least , the path is of length .
Observe that the argument above applies when considering any start vertex in . Hence, by a union bound over all possible start vertices in , all paths starting at an vertex are of length with probability at least . Last, observe that a longest path that may be able to form could also start at a -vertex. Such a path however is only by one edge longer than a path starting at an -vertex. The length bound therefore still holds.
So far, we proved that for a message that corresponds to at least inputs, Bob can only output a path of length at most with high probability, where the probability is over Bob’s input. Hence, overall, for a uniform input from , the probability that Bob will output a path of length is at least for large enough. We use the notation to denote LP with approximation factor and error probability .
Theorem 13.
The randomized one-way communication complexity of on inputs from is .
Proof.
Towards a contradiction, let be a randomized protocol for Longest Path on inputs from with approximation factor that errs with probability at most . Given , by Yao’s Lemma, there exists a deterministic protocol on distribution with distributional error and approximation factor , i.e., on at least of the inputs, the protocol achieves a -approximation.
Lemma 11 states that . This allows us to bound the quantity , as follows:
where we used the fact that the longest path in is at most the number of vertices in , i.e., . The previous inequality then implies that .
Next, Lemma 12 states that, with probability at least , outputs a path of length at most . Hence, with probability at least , there simultaneously exists a longest path of length at least and outputs one of length . The approximation factor of is therefore , contradicting the fact that achieves an approximation factor of on at least of the instances. Protocols and therefore do not exist, which completes the proof.
Lemma 14.
Let be a randomized protocol for on inputs from . Then:
Proof.
Denote by a randomized one-way two-party communication protocol for on inputs from . Given , using the message compression technique stated in Theorem 9, we obtain a protocol for that sends a message of expected size (recall that is Alice’s input matching)
| (1) |
where the expectation is taken over the randomness used by the protocol. Then, by the Markov inequality, the probability that the message is of size at least is at most .
Given , we now construct a protocol with maximum message size that solves LP with slightly increased error: Whenever sends a message of size at most , also sends this message and the protocol behaves exactly the same as . However, when sends a message of size at least , aborts and thus fails. Since the probability of sending a message of size larger than is , the error probability of is . From Theorem 13, we obtain that the communication cost of is , which implies that . Hence, combined with Inequality 1, we conclude that
where the inequality follows from property P1 stated in the preliminaries.
4.2 Hard Input Distribution and Direct Sum Argument
The input distribution used to obtain our main lower bound is stated in Figure 4.
Input Distribution :
Let be an -RS graphs with and induced matchings .
Alice’s Input: Edge set
Given , we construct the directed bipartite graph , where:
-
is a copy of , and and are copies of .
-
For every edge , we flip an unbiased coin . If it comes out heads then the directed edge between the sets and is introduced, and if it comes out tail then the directed edge between the sets and is introduced.
We denote the edges in that originated from the matching , for any , by . Alice holds the edges .
Bob’s Input: Edge set
-
Let be a uniform random index.
-
Consider the matching and let and . Let be a uniform random matching between and .
-
Bob introduces two copies of into : To this end, let be the copy of in , let be the copy of in , and let be the copy of in . The first copy is introduced between and , and the second copy is introduced between and . The edges in and are directed such that the -vertex constitutes the head and the -vertex the tail of the directed edge.
Bob holds the edges .
We now argue that a protocol that solves LP under distribution can be used to obtain a protocol that solves LP under , where is the size of the induced matchings of the RS-graph used in . This establishes a connection between the information costs of and . We use the reduction stated in Algorithm 2.
This reduction has the following properties:
Lemma 15.
Consider the reduction in Algorithm 2. Given any path in of length at least , the path with the first and last edge removed only uses edges from .
Proof.
Let be a path of length at least in . Since is bipartite, every other edge in must be an edge from since these are the only edges with head in . Observe that the edges are the only edges with both endpoints in and . Hence, for any three consecutive edges in path , if and are edges from , then must be an edge from . It follows that if an edge that is not contained in is included in then this edge must be the first or the last edge of .
Given our reduction, we now relate the information costs of and :
Lemma 16.
Let be a protocol for , for some parameters and , and let be the protocol obtained from via the reduction given in Algorithm 2. Then, has approximation factor , errs with the same probability , and:
Proof.
We denote by and the public randomness used in and in , respectively. Then (see the rules P1, …, P4 in the preliminaries):
| P2 | ||||
| P3 | ||||
| P1 | ||||
| P4 | ||||
Regarding the approximation factor, observe that . Furthermore, by Lemma 15, the path found by is at most by shorter than the path found by , which in turn is of length at least . Hence, the approximation factor of is bounded by . We are now ready to state our main lower bound result for directed graphs.
Theorem 17.
The randomized one-way communication complexity of is .
Proof.
Let be a protocol for . Then, from Lemmas 16 and 14, we obtain
Since the choice of was arbitrary, and information complexity is a lower bound on communication complexity, the result follows.
Finally using the well-known connection between streaming algorithms and one-way two-party communication protocols as well as the RS-graph construction by Alon et al. as stated in Theorem 7, we obtain the following theorem:
Theorem 3.
Any one-pass algorithm for requires space .
5 Conclusion
We studied one-pass streaming algorithms for LP and showed that, in both insertion-only and insertion-deletion streams, for undirected graphs, there are semi-streaming algorithms that find paths of lengths at least with high probability, where is the average degree of the input graph. The algorithm can also give an -approximation algorithm that uses space . We then showed that no such result can be obtained for directed graphs in that a -approximation requires space , even in insertion-only streams. We also showed that semi-streaming algorithms in the insertion-only model for undirected graphs cannot yield an arbitrarily small constant factor approximation, and, in insertion-deletion streams, space is necessary to obtain an -approximation in undirected graphs.
We conclude with two open questions: First, while we resolved the space complexity of one-pass algorithms for directed graphs in both the insertion-only and the insertion-deletion models, the space complexity for undirected graphs, in particular, in the insertion-only model, remains wide open. Can we close this gap? Second, for undirected graphs, are there multi-pass semi-streaming algorithms that compute paths longer than , where is the average degree of the input graph?
References
- [1] Kook Jin Ahn, Graham Cormode, Sudipto Guha, Andrew McGregor, and Anthony Wirth. Correlation clustering in data streams. Algorithmica, 83(7):1980–2017, 2021. doi:10.1007/S00453-021-00816-9.
- [2] Noga Alon, Ankur Moitra, and Benny Sudakov. Nearly complete graphs decomposable into large induced matchings and their applications. In Howard J. Karloff and Toniann Pitassi, editors, Proceedings of the 44th Symposium on Theory of Computing Conference, STOC 2012, New York, NY, USA, May 19–22, 2012, pages 1079–1090. ACM, 2012. doi:10.1145/2213977.2214074.
- [3] Sepehr Assadi. A two-pass (conditional) lower bound for semi-streaming maximum matching. In Joseph (Seffi) Naor and Niv Buchbinder, editors, Proceedings of the 2022 ACM-SIAM Symposium on Discrete Algorithms, SODA 2022, Virtual Conference / Alexandria, VA, USA, January 9–12, 2022, pages 708–742. SIAM, 2022. doi:10.1137/1.9781611977073.32.
- [4] Sepehr Assadi, Soheil Behnezhad, Christian Konrad, Kheeran K. Naidu, and Janani Sundaresan. Settling the pass complexity of approximate matchings in dynamic graph streams. In Yossi Azar and Debmalya Panigrahi, editors, Proceedings of the 2025 Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2025, New Orleans, LA, USA, January 12-15, 2025, pages 864–904. SIAM, 2025. doi:10.1137/1.9781611978322.25.
- [5] Sepehr Assadi, Aaron Bernstein, Zachary Langley, Lap Chi Lau, and Robert Wang. Streaming and communication complexity of load-balancing via matching contractors. In Yossi Azar and Debmalya Panigrahi, editors, Proceedings of the 2025 Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2025, New Orleans, LA, USA, January 12-15, 2025, pages 3423–3449. SIAM, 2025. doi:10.1137/1.9781611978322.113.
- [6] Sepehr Assadi, Yu Chen, and Sanjeev Khanna. Sublinear algorithms for ( + 1) vertex coloring. In Timothy M. Chan, editor, Proceedings of the Thirtieth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2019, San Diego, California, USA, January 6-9, 2019, pages 767–786. SIAM, 2019. doi:10.1137/1.9781611975482.48.
- [7] Sepehr Assadi, Sanjeev Khanna, and Yang Li. On estimating maximum matching size in graph streams. In Philip N. Klein, editor, Proceedings of the Twenty-Eighth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2017, Barcelona, Spain, Hotel Porta Fira, January 16-19, pages 1723–1742. SIAM, 2017. doi:10.1137/1.9781611974782.113.
- [8] Sepehr Assadi, Sanjeev Khanna, Yang Li, and Grigory Yaroslavtsev. Maximum matchings in dynamic graph streams and the simultaneous communication model. In Robert Krauthgamer, editor, Proceedings of the Twenty-Seventh Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2016, Arlington, VA, USA, January 10-12, 2016, pages 1345–1364. SIAM, 2016. doi:10.1137/1.9781611974331.CH93.
- [9] Sepehr Assadi, Christian Konrad, Kheeran K. Naidu, and Janani Sundaresan. O(log log n) passes is optimal for semi-streaming maximal independent set. In Bojan Mohar, Igor Shinkar, and Ryan O’Donnell, editors, Proceedings of the 56th Annual ACM Symposium on Theory of Computing, STOC 2024, Vancouver, BC, Canada, June 24-28, 2024, pages 847–858. ACM, 2024. doi:10.1145/3618260.3649763.
- [10] Andreas Björklund, Thore Husfeldt, Petteri Kaski, and Mikko Koivisto. Narrow sieves for parameterized paths and packings. Journal of Computer and System Sciences, 87:119–139, 2017. doi:10.1016/j.jcss.2017.03.003.
- [11] Andreas Björklund, Thore Husfeldt, and Sanjeev Khanna. Approximating longest directed paths and cycles. In Josep Díaz, Juhani Karhumäki, Arto Lepistö, and Donald Sannella, editors, Automata, Languages and Programming, pages 222–233, Berlin, Heidelberg, 2004. Springer Berlin Heidelberg. doi:10.1007/978-3-540-27836-8_21.
- [12] Amit Chakrabarti, Prantar Ghosh, Andrew McGregor, and Sofya Vorotnikova. Vertex ordering problems in directed graph streams. In Shuchi Chawla, editor, Proceedings of the 2020 ACM-SIAM Symposium on Discrete Algorithms, SODA 2020, Salt Lake City, UT, USA, January 5-8, 2020, pages 1786–1802. SIAM, 2020. doi:10.1137/1.9781611975994.109.
- [13] Yi-Jun Chang, Martin Farach-Colton, Tsan-sheng Hsu, and Meng-Tsung Tsai. Streaming complexity of spanning tree computation. In Christophe Paul and Markus Bläser, editors, 37th International Symposium on Theoretical Aspects of Computer Science, STACS 2020, March 10-13, 2020, Montpellier, France, volume 154 of LIPIcs, pages 34:1–34:19. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2020. doi:10.4230/LIPICS.STACS.2020.34.
- [14] Graham Cormode, Jacques Dark, and Christian Konrad. Independent sets in vertex-arrival streams. In Christel Baier, Ioannis Chatzigiannakis, Paola Flocchini, and Stefano Leonardi, editors, 46th International Colloquium on Automata, Languages, and Programming, ICALP 2019, July 9-12, 2019, Patras, Greece, volume 132 of LIPIcs, pages 45:1–45:14. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2019. doi:10.4230/LIPICS.ICALP.2019.45.
- [15] Jacques Dark and Christian Konrad. Optimal lower bounds for matching and vertex cover in dynamic graph streams. In Shubhangi Saraf, editor, 35th Computational Complexity Conference, CCC 2020, July 28-31, 2020, Saarbrücken, Germany (Virtual Conference), volume 169 of LIPIcs, pages 30:1–30:14. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2020. doi:10.4230/LIPICS.CCC.2020.30.
- [16] Joan Feigenbaum, Sampath Kannan, Andrew McGregor, Siddharth Suri, and Jian Zhang. On graph problems in a semi-streaming model. Theor. Comput. Sci., 348(2-3):207–216, 2005. doi:10.1016/J.TCS.2005.09.013.
- [17] Eldar Fischer, Eric Lehman, Ilan Newman, Sofya Raskhodnikova, Ronitt Rubinfeld, and Alex Samorodnitsky. Monotonicity testing over general poset domains. In John H. Reif, editor, Proceedings on 34th Annual ACM Symposium on Theory of Computing, May 19-21, 2002, Montréal, Québec, Canada, pages 474–483. ACM, 2002. doi:10.1145/509907.509977.
- [18] Ashish Goel, Michael Kapralov, and Sanjeev Khanna. On the communication and streaming complexity of maximum bipartite matching. In Yuval Rabani, editor, Proceedings of the Twenty-Third Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2012, Kyoto, Japan, January 17-19, 2012, pages 468–485. SIAM, 2012. doi:10.1137/1.9781611973099.41.
- [19] S. W. Golomb. Random permutations. Bull. Amer. Math. Soc. 70, 1964.
- [20] S. W. Golomb, L. R. Welch, and R. M. Goldstein. Cycles from nonlinear shift registers. Technical report, Progress Rep. No. 20-389, Jet Propulsion Laboratory, California Institute of Technology, Pasadena, California, 1959.
- [21] Prahladh Harsha, Rahul Jain, David A. McAllester, and Jaikumar Radhakrishnan. The communication complexity of correlation. In 22nd Annual IEEE Conference on Computational Complexity (CCC 2007), 13-16 June 2007, San Diego, California, USA, pages 10–23. IEEE Computer Society, 2007. doi:10.1109/CCC.2007.32.
- [22] Hossein Jowhari, Mert Saglam, and Gábor Tardos. Tight bounds for lp samplers, finding duplicates in streams, and related problems. In Maurizio Lenzerini and Thomas Schwentick, editors, Proceedings of the 30th ACM SIGMOD-SIGACT-SIGART Symposium on Principles of Database Systems, PODS 2011, June 12-16, 2011, Athens, Greece, pages 49–58. ACM, 2011. doi:10.1145/1989284.1989289.
- [23] Ramkumar G. D. S. Karger D, Motwani R. On approximating the longest path in a graph. Algorithmica, pages 82–98, 1997. doi:10.1007/BF02523689.
- [24] Shahbaz Khan and Shashank K. Mehta. Depth First Search in the Semi-streaming Model. In Rolf Niedermeier and Christophe Paul, editors, 36th International Symposium on Theoretical Aspects of Computer Science (STACS 2019), volume 126 of Leibniz International Proceedings in Informatics (LIPIcs), pages 42:1–42:16, Dagstuhl, Germany, 2019. Schloss Dagstuhl – Leibniz-Zentrum für Informatik. doi:10.4230/LIPIcs.STACS.2019.42.
- [25] Lasse Kliemann, Christian Schielke, and Anand Srivastav. A streaming algorithm for the undirected longest path problem. In Piotr Sankowski and Christos D. Zaroliagis, editors, 24th Annual European Symposium on Algorithms, ESA 2016, August 22-24, 2016, Aarhus, Denmark, volume 57 of LIPIcs, pages 56:1–56:17. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2016. doi:10.4230/LIPICS.ESA.2016.56.
- [26] Christian Konrad and Kheeran K. Naidu. On two-pass streaming algorithms for maximum bipartite matching. In Mary Wootters and Laura Sanità, editors, Approximation, Randomization, and Combinatorial Optimization. Algorithms and Techniques, APPROX/RANDOM 2021, August 16-18, 2021, University of Washington, Seattle, Washington, USA (Virtual Conference), volume 207 of LIPIcs, pages 19:1–19:18. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2021. doi:10.4230/LIPICS.APPROX/RANDOM.2021.19.
- [27] Christian Konrad and Kheeran K. Naidu. An unconditional lower bound for two-pass streaming algorithms for maximum matching approximation. In David P. Woodruff, editor, Proceedings of the 2024 ACM-SIAM Symposium on Discrete Algorithms, SODA 2024, Alexandria, VA, USA, January 7-10, 2024, pages 2881–2899. SIAM, 2024. doi:10.1137/1.9781611977912.102.
- [28] Christian Konrad, Kheeran K. Naidu, and Arun Steward. Maximum matching via maximal matching queries. In Petra Berenbrink, Patricia Bouyer, Anuj Dawar, and Mamadou Moustapha Kanté, editors, 40th International Symposium on Theoretical Aspects of Computer Science, STACS 2023, March 7-9, 2023, Hamburg, Germany, volume 254 of LIPIcs, pages 41:1–41:22. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2023. doi:10.4230/LIPICS.STACS.2023.41.
- [29] Andrew McGregor. Finding graph matchings in data streams. In Chandra Chekuri, Klaus Jansen, José D. P. Rolim, and Luca Trevisan, editors, Approximation, Randomization and Combinatorial Optimization, Algorithms and Techniques, 8th International Workshop on Approximation Algorithms for Combinatorial Optimization Problems, APPROX 2005 and 9th InternationalWorkshop on Randomization and Computation, RANDOM 2005, Berkeley, CA, USA, August 22-24, 2005, Proceedings, volume 3624 of Lecture Notes in Computer Science, pages 170–181. Springer, 2005. doi:10.1007/11538462_15.
- [30] Slobodan Mitrovi?, Anish Mukherjee, Piotr Sankowski, and Wen-Horng Sheu. Faster semi-streaming matchings via alternating trees, 2025. doi:10.48550/arXiv.2412.19057.
- [31] Anup Rao and Amir Yehudayoff. Communication Complexity: and Applications. Cambridge University Press, 2020.
- [32] Jeffrey Scott Vitter. Random sampling with a reservoir. ACM Trans. Math. Softw., 11(1):37–57, 1985. doi:10.1145/3147.3165.
Appendix A Technical Lemmas
Lemma 18.
Let be positive with . Then:
Proof.
We compute as follows:
where we used the inequality , which holds for all .
Lemma 19.
Let be a graph with , , and average degree . Then, there exists a subset of vertices such that the vertex-induced subgraph has minimum degree greater than .
Proof.
We iteratively remove vertices of degree at most from until no such vertex is left. Let be the graph with the first vertices removed, and let . We denote the number of edges in , and the number of vertices in . It can then be seen by induction that the average degree of every graph is still at least . Indeed, observe that removing a vertex of degree at most removes at most edges from the graph. Then, the average degree of graph is:
Then, since the average degree remains as high as throughout, and we only ever remove vertices of degree at most , the process must leave a non-empty graph with minimum degree at least behind. The set then is the set of vertices that are not removed by this process.
