A Linear Time Algorithm for Finding Three Edge-Disjoint Paths in Eulerian Networks
Consider an undirected graph $G = (VG, EG)$ and a set of six \emph{terminals} $T = \set{s_1, s_2, s_3, t_1, t_2, t_3} \subseteq VG$. The goal is to find a collection $\calP$ of three edge-disjoint paths $P_1$, $P_2$, and $P_3$, where $P_i$ connects n…
Authors: Maxim Babenko, Ignat Kolesnichenko, Ilya Razenshteyn
We shall use some standard graph-theoretic notation through the paper. For an undirected graph G, we denote its sets of nodes and edges by V G and EG, respectively. For a directed graph, we speak of arcs rather than edges and denote the arc set of G by AG. A similar notation is used for paths, trees, and etc. We allow parallel edges and arcs but not loops in graphs.
For an undirected graph G and U ⊆ V G, we write δ G (U ) to denote the set of edges with exactly one endpoint in U . If G is a digraph then the set of arcs entering (resp. leaving) U is denoted by δ in G (U ) and δ out G (U ). For a graph G and a subset U ⊆ V G, we write G[U ] to denote the subgraph of G induced by U .
Let G be an undirected graph. Consider six nodes s 1 , s 2 , s 3 , t 1 , t 2 , t 3 in G. These nodes need not be distinct and will be called terminals. Our main problem is as follows:
(1) Find a collection of three edge-disjoint paths P 1 , P 2 , P 3 , where P i goes from s i to t i (for i = 1, 2, 3).
Robertson and Seymour [RS95] developed sophisticated graph minor techniques that, in particular, imply a polynomial time solvability of the above problem. More specifically, they deal with the general case where k pairs of terminals {s 1 , t 1 } , . . . , {s k , t k } are given and are requested to be connected by paths. These paths are required to be node-disjoint. The edge-disjoint case, however, can be easily simulated by considering the line graph of G. For fixed k, the running time of the algorithm of Robertson and Seymour is cubic in the number of nodes (with a constant heavily depending on k). Since after reducing the edge-disjoint case to the node-disjoint one the number of nodes becomes Θ(m), one gets an algorithm of time complexity O(m 3 ) (where, throughout the paper, n := |V G|, m := |EG|; moreover, it is assumed that n = O(m)). If k is a part of input, then it was shown by Marx [Mar04] that finding k edge-disjoint paths is NP-complete even in the Eulerian case.
We may also consider a general integer multiflow problem. To this aim, consider an arbitrary (multi-)graph G and also an arbitrary (multi-)graph H obeying V H = V G. The latter graph H is called the demand graph. The task is to find a function f assigning each edge uv ∈ EH a u-v path f (uv) in G such that the resulting paths {f (e) | e ∈ EH} are edge-disjoint. Hence, the edges of H correspond to the paths in the desired solution. By a problem instance we mean the pair (G, H). An instance is feasible if the desired collection of edge-disjoint paths exists; infeasible otherwise.
In case of three terminal pairs one has H = (V G, {s 1 t 1 , s 2 t 2 , s 3 t 3 }). We can simplify the problem and get better complexity results by introducing some additional assumptions regarding the degrees of nodes in G. Put G + H := (V G, EG ∪ EH). Suppose the degrees of all nodes in G + H are even; the corresponding instances are called Eulerian.
As observed by Schrijver, for the Eulerian case there exists a simple feasibility criterion. For a subset
The inequalities figured in the above theorem are called cut conditions. In a general problem (where demand graph H is arbitrary) these inequalities provide necessary (but not always sufficient) feasibility requirements.
For the Eulerian case, the problem is essentially equivalent to constructing two paths (out of three requested by the demand graph). Indeed, if edge-disjoint paths P 1 and P 2 (where, as earlier, P i connects s i and t i , i = 1, 2) are found, the remaining path P 3 always exists. Indeed, remove the edges of P 1 and P 2 from G. Assuming s 3 = t 3 , the remaining graph has exactly two odd vertices, namely s 3 and t 3 . Hence, these vertices are in the same connected component. However, once we no longer regard s 3 and t 3 as terminals and try to solve the four terminal instance, we lose the Eulerianess property. There are some efficient algorithms (e.g. [SP78,Shi80,Tho04,Tho09]) for the case of two pairs of terminals (without Eulerianess assumption) but no linear time bound seems to be known.
The proof of Theorem 1 presented in [Sch03] is rather simple but nonconstructive. Our main result is as follows:
Theorem 2. An Eulerian instance of the problem (1) can be checked for feasibility in O(m) time. If the check turns out positive, the desired path collection can be constructed in O(m) time.
This subsection describes some basic techniques for working with edge-disjoint paths. If the reader is familiar with network flow theory, this subsection may be omitted.
Suppose we are given an undirected graph G and a pair of distinct nodes s (source) and t (sink
Edge-disjoint path collections can be described in flow-like terms as follows.
-→ G denote the digraph obtained from G by replacing each edge with a pair of oppositely directed arcs. A subset Obviously, for each collection P of edge-disjoint s-t paths in G there exists a balanced arc set of value |P|. Vice versa, each balanced arc set F in -→ G generates at least val(F ) edge-disjoint s-t paths in G. Hence, finding a maximum cardinality collection of edge-disjoint s-t paths in G amounts to maximizing the value of a balanced arc set.
Given a balanced set F , consider the residual digraph
), where F -1 := a -1 | a ∈ F and a -1 denotes the arc reverse to a.
Lemma 2. Let P be an arc-simple s-t path in -→ G F . Construct the arc set F ′ as follows: (i) take set F ; (ii) add all arcs a ∈ AP such that a -1 / ∈ F ; (iii) remove all arcs a ∈ F such that a -1 ∈ AP . Then, F ′ is balanced and obeys val(F ′ ) = val(F ) + 1. Lemma 3. Suppose there is no s-t path in -→ G F . Then F is of maximum value. Moreover, the set U of nodes that are reachable from s in -→ G F obeys d G (U ) = val(F ). Additionally, U is an inclusion-wise minimum such set.
Hence, to find a collection of r edge-disjoint s-t paths one needs to run a reachability algorithm in a digraph at most r times. Totally, this takes O(rm) time and is known as the method of Ford and Fulkerson [FF62].
We start with a number of easy observations. Firstly, there are some simpler versions of (1). Suppose only one pair of terminals is given, i.e. H = (V G, {s 1 t 1 }).
Then the problem consists in checking if s 1 and t 1 are in the same connected component of G. Note that if the instance (G, H) is Eulerian then it is always feasible since a connected component cannot contain a single odd vertex. An s 1 -t 1 path P 1 can be found in O(m) time.
Next, consider the case of two pairs of terminals, i.e. H = (V G, {s 1 t 1 , s 2 t 2 }). Connected components of G not containing any of the terminals may be ignored. Hence, one may assume that G is connected since otherwise the problem reduces to a pair of instances each having a single pair of terminals.
G is connected then (G, H) is feasible. Also, the desired path collection {P 1 , P 2 } can be found in O(m) time.
The argument is the same as in Section 1. Consider an arbitrary s 1 -t 1 path P 1 and remove it from G. The resulting graph G ′ may lose connectivity, however, s 2 and t 2 are the only odd vertices in it (assuming s 2 = t 2 ). Hence, s 2 and t 2 are in the same connected component of G ′ , we can trace an s 2 -t 2 path P 2 and, hence, solve the problem. The time complexity of this procedure is obviously O(m). Now we explain how the feasibility of an Eulerian instance (G, H) having three pairs of terminals can be checked in linear time. Put T := {s 1 , s 2 , s 3 , t 1 , t 2 , t 3 }. There are exponentially many subsets U ⊆ V G. For each subset U consider its signature U * := U ∩ T . Fix an arbitrary signature U * ⊆ T and assume w.l.o.g. that δ H (U * ) = {s 1 t 1 , . . . , s k t k }. Construct a new undirected graph G(U * ) as follows: add source s * , sink t * , and 2k auxiliary edges s * s 1 , . . . , s * s k , t 1 t * , . . . , t k t * to G.
Let ν(U * ) be the maximum cardinality of a collection of edge-disjoint s * -t * paths in G(U * ). We restate Theorem 1 as follows:
Necessity being obvious, we show sufficiency. Let (G, H) be infeasible, then by Theorem
By the above lemma, to check (G, H) for feasibility one has to validate the inequalities ν(U * ) ≥ d H (U * ) for all U * ⊆ T . For each fixed signature U * we consider graph G(U * ), start with an empty balanced arc set and perform up to three augmentations, as explained in Subsection 2.1. Therefore, the corresponding inequality is checked in O(m) time. The number of signatures is O(1), which gives the linear time for the whole feasibility check.
We now present our first O(m 2 ) time algorithm for finding the required path collection. It will not be used in the sequel but gives some initial insight on the problem. Consider an instance (G, H) and let s 1 , t 1 ∈ T be a pair of terminals (s If (G e , H e ) is feasible (say, P e is a solution) then so is (G, H) as we can append the edge e to the s ′ 1 -t 1 path in P e and obtain a solution P to (G, H). Since (G, H) is feasible, there must be a feasible local move (e.g. along the first edge of an s 1 -t 1 path in a solution). We find this move by enumerating all edges e incident to s 1 and checking (G e , H e ) for feasibility. Once e is found, we recurse to the instance (G e , H e ) having one less edge. This way, a solution to the initial problem is constructed.
To estimate the time complexity, note that if a move along some edge e is discovered to be infeasible at some stage then it remains infeasible for the rest of the algorithm (since the edge set of G can only decrease). Hence, each edge in G can be checked for feasibility at most once. Each such check costs O(m) time, thus yielding the total bound of O(m 2 ). This is already an improvement over the algorithm of Robertson and Seymour. However, we can do much better.
To solve an Eulerian instance of (1) in linear time we start by constructing an arbitrary node-simple s 1 -t 1 path P 1 . Let e 1 , . . . , e k be the sequence of edges of P 1 . For each i = 0, . . . , k let (G i , H i ) be the instance obtained from the initial one (G, H) by a sequence of local moves along the edges e 1 , . . . , e i . In particular, (G 0 , H 0 ) = (G, H).
If (G k , H k ) is feasible (which can be checked in O(m) time) then the problem reduces to four terminals and can be solved in linear time by Lemma 4. Otherwise we find an index j such that (G j , H j ) is a feasible instance whereas (G j+1 , H j+1 ) is not feasible. This is done by walking in the reverse direction along P 1 and considering the sequence of instances (G k , H k ), . . . , (G 0 , H 0 ). Fix an arbitrary signature U * in (G k , H k ). As we go back along P 1 , terminal s 1 is moving. We apply these moves to U * and construct a sequence of signatures
When s 1 is moved from node v back to v ′ , edge s * v is removed and edges s * v ′ and v ′ v are inserted. Note, that this cannot decrease the maximum cardinality of an edge-disjoint s * -t * paths collection (if the dropped edge s * v was used by some path in a collection, then we may replace it by a sequence of edges s * v ′ and v ′ v). Hence,
Our goal is to find, for each choice of U * , the largest index i (denote it by j(U * )) such that
we get the desired feasible instance (G j , H j ) such that (G j+1 , H j+1 ) is infeasible.
To compute the values ν i (U * i ) consider the following dynamic problem. Suppose one is given an undirected graph Γ with distinguished source s and sink t, and also an integer r ≥ 1. We need the following operations:
Query: Report min(r, c), where c is the maximum cardinality of a collection of edge-disjoint s-t paths in Γ .
Remove the edge sv from Γ and add edges sv ′ and v ′ v to Γ . Lemma 6. There exists a data structure that can execute any sequence of Query and Move requests in O(rm) time.
We use a version of a folklore incremental reachability data structure. When graph Γ is given to us, we start computing a balanced arc set F in -→ Γ of maximum value val(F ) but stop if val(F ) becomes equal to r. This takes O(rm) time. During the usage of the required data structure, the number of edge-disjoint s-t paths (hence, val(F )) cannot decrease (it can be shown using arguments similar to the described earlier). Therefore, if val(F ) = r we may stop any maintenance and report the value of r on each Query.
Otherwise, as val(F ) is maximum, there is no s-t path in -→ Γ F by Lemma 3. As long as no r edge-disjoint s-t paths in Γ exist, the following objects are maintained:
a balanced subset F ⊆ AΓ of maximum value val(F ) (which is less than r); -an inclusionwise maximal directed tree T rooted at t and consisting of arcs from -→ Γ F (oriented towards to t).
In particular, T covers exactly the set of nodes that can reach t by a path in -→ Γ F . Hence, s is not covered by T (by Lemma 2).
Consider a Move(v, v ′ ) request. We update F as follows. If sv / ∈ F , then no change is necessary. Otherwise, we remove sv from F and also add arcs sv ′ and v ′ v to F . This way, F remains balanced and val(F ) is preserved.
Next, we describe the maintenance of T . Adding an arbitrary edge e to Γ is simple. Recall that each edge in Γ generates a pair of oppositely directed arcs in -→ Γ . Let a = pq be one of these two arcs generated by e. Suppose a is present in -→ Γ F . If a ∈ δ in (V T ) (i.e., p is not reachable and q is reachable) then add a to T . Next, continue growing T incrementally from p by executing a depth-first search and stopping at nodes already covered by T . This way, T is extended to a maximum directed tree rooted at t. In other cases (a / ∈ δ in (V T )) arc a is ignored.
Next consider deleting edge sv from G. We argue that its removal cannot invalidate T , that is, sv does not generate an arc from T . This is true since t is not reachable from s and, hence, arcs incident to s may not appear in T .
Note that a breakthrough may occur during the above incremental procedure, i.e. node t may become reachable from s at some point. When this happens, we trace the corresponding s-t path in T , augment F according to Lemma 2, and recompute T from scratch. Again, any further activity stops once val(F ) reaches r.
To estimate the complexity, note that between breakthroughs we are actually dealing with a single suspendable depth-first traversal of -→ Γ F . Each such traversal costs O(m) time and there are at most r breakthroughs. Hence, the total bound of O(rm) follows.
We apply the above data structure to graph G k (U * k ) for r = d H (U * ) and make the moves in the reverse order, as explained earlier. Once Query reports the existence of r edge-disjoint s * -t * paths in G i (U * i ), put j(U * ) := i and proceed to the next signature. This way, each value j(U * ) can be computed in O(m) time. There are O(1) signatures and r = O(1), hence computing j takes linear time as well.
The final stage deals with problem instance (G j , H j ). For brevity, we reset G := G j , H := H j and also denote G ′ := G j+1 , H ′ := H j+1 . Consider the connected components of G. Components not containing any terminals may be dropped. If G contains at least two components with terminals, the problem reduces to simpler cases described in Subsection 2.2. Hence, one can assume that G is connected. We prove that (G, H) is, in a sense, critical, that is, it admits a cut of a very special structure.
Fig. 1. A critical instance (G, H). Terminals are marked with dots and renumbered. Wavy lines indicate parts of paths in the desired collection P.
Lemma 7. There exists a subset
Proof.
The following is true:
( H) by a single local move, (iii) (G ′ , H ′ ) is infeasible, (iv) let s ∈ V G ′ be the new location of the moved terminal, st ∈ EH ′ , then s and t are in the same connected component of G ′ .
Properties (i)-(iii) are ensured by the choice of j. Property (iv) holds since there exists a remaining (untraversed) part of the initial s 1 -t 1 path in the original graph G.
We apply a number of contractions to (G, H) and (G ′ , H ′ ) that preserve condition (2). Suppose the following:
In other words, there is a bridge e = uv ∈ EG, u ∈ U , v ∈ V G -U (an edge whose removal increases the number of connected components) that separates G into parts G[U ] and G[V G -U ] and the former part contains a single terminal, say s. We argue that the local move, which produced (G ′ , H ′ ), was carried out in the subgraph G[V G -U ] (but not in G[U ] or along the edge e).
Firstly, the move could not have been applied to s. Suppose the contrary. Terminal s is connected to node v by some path in G[U ∪ {v}] and this property remains true even if apply a local move to s. (Nodes v and s are the only odd vertices in G[U ∪ {v}], hence, these nodes cannot fall into distinct connected components after the move.) Therefore, (G, H) and (G ′ , H ′ ) are simultaneously feasible or infeasible.
Next, suppose that v is a terminal and the move is carried out along the bridge e. Then, vs / ∈ EH ′ (otherwise, (G ′ , H ′ ) remains feasible). Therefore, vw ∈ EH ′ for some w ∈ V G -U . Then v and w belong to different connected components of G ′ after the move, which is impossible by (2)(iv).
Contract We proceed with these contractions until no subset U obeying (3) remains. Next, since (G ′ , H ′ ) is infeasible by Theorem 1 there exists a subset
At the same time, (G, H) is feasible and hence
(3) still holds). Therefore, Case 1 from Fig. 1(a) applies (note that terminals s i and t i depicted there are appropriately renumbered). Let us explain, why this case is impossible. Graph G ′ is obtained from G by removing edge uv. Let, as in (2)(iv), s denote the terminal in (G, H) that is being moved and t denote its "mate" terminal (i.e. st ∈ EH). We can assume by symmetry that u = s. Hence, v is the new location of s in (G ′ , H ′ ). By (2)(iv), v and t are in the same connected component of G ′ . The latter is only possible if s = u = s 1 and t = t 1 . But then feasibility of (G, H) implies that of (G ′ , H ′ ).
Finally, let d H (U ) = 2. Replacing U by V G -U , if necessary, we may assume that |U ∩ T | = 2, see Fig. 1
due to feasibility of (G, H) and connectivity of G). Therefore, (3) still holds (both for U := U 1 and U := U 2 ) -a contradiction.
Once set U is found, we undo the contractions described in the beginning and obtain a set U for the original instance (G, H). Clearly, these uncontractions preserve the required properties of U . Lemma 8. Set U figured in Lemma 7 can be constructed in O(m) time.
We enumerate pairs of terminals p, q ∈ T that might qualify for U * := U ∩ T = {p, q}. Take all such pairs U * = {p, q} except those forming an edge in H (pq ∈ EH). Contract U * and T -U * into s * and t * , respectively, in the graphs G and H. The resulting graphs are denoted by G * and H * . If a subset obeying Lemma 7 and having the signature U * exists then there must be an
We try to construct U by applying three iterations of the max-flow algorithm of Ford and Fulkerson, see Subsection 2.1. If the third iteration succeeds, i.e. three edge-disjoint s * -t * paths are found, then no desired cut U having signature U * exists; we continue with the next choice of U * . Otherwise, a subset
Set U is constructed for graph G * but may also be regarded as a subset of V G. We keep notation U when referring to this subset.
Connectivity of G[U ] is the only remaining property we need to ensure. This is achieved by selecting an inclusion-wise maximal set U among minimum-capacity cuts that separate {p, q} and T -{p, q}. Such maximality can achieved in a standard way, i.e. by traversing the residual network in backward direction from the sink t * , see Lemma 3.
To see that G[U ] is connected suppose the contrary. Then, as in the proof of Lemma 7, let U 1 and U 2 be the node sets of the connected components of G[U ]. Edges in δ G (U ) = {e 1 , e 2 } are bridges connecting G[U i ] to the remaining part of graph G (for i = 1, 2). Also, |U 1 ∩ T | = |U 2 ∩ T | = 1 (recall that G is connected). Denote U 1 ∩ T = {q 1 } and U 2 ∩ T = {q 2 }. Terminals q 1 and q 2 are not connected in G[U ]. Since set U is inclusion-wise maximal, any subset U ′ satisfying Lemma 7 also obeys U ′ ⊆ U . But then q 1 and q 2 are also disconnected in G[U ′ ], which is a contradiction. Therefore, no valid subset U of signature U * obeying Lemma 7 exists.
In the algorithm, we check G[U ] for connectivity in O(m) time. If the graph is not connected, then we proceed with the next signature U * . Now everything is in place to complete the proof of Theorem 2. By Lemma 8, finding set U takes O(m) time. It remains to construct a solution to (G, H). Put δ G (U ) = {e 1 , e 2 }, e i = u i v i , u i ∈ U , v i ∈ V G-U , i = 1, 2. Again, after renaming some terminals we may assume that s 1 , s 2 ∈ U , t 1 , t 2 , s 3 , t 3 ∈ V G -U . Augment G by adding two new nodes s * and t * and auxiliary edges s * u 1 , s * u 2 , t 1 t * , and t 2 t * . Due to feasibility of (G, H), there exists (and can be constructed in O(m) time) a collection of two edge-disjoint s * -t * paths. After removing auxiliary edges we either obtain a u 1 -t 1 path and a u 2 -t 2 path (Case A) or a u 1 -t 2 path and a u 2 -t 1 path (Case B). To extend these paths to an s 1 -t 1 path and an s 2 -t 2 path we consider a four terminal instance in the subgraph G[U ]. The demand graph is (U, {s 1 u 1 , s 2 u 2 }) in Case A and (U, {s 1 u 2 , s 2 u 1 }) in Case B. As G[U ] is connected, the latter instance is feasible by Lemma 4. Therefore, we obtain edge-disjoint s 1 -t 1 and s 2 -t 2 paths P 1 and P 2 , respectively. As explained earlier in Section 1, the remaining path P 3 always exists and can be found in O(m) time. Therefore, the proof of Theorem 2 is complete.
e = H -s 1 t 1 +s ′ 1 t 1 (i.e. we remove edge e and choose s ′ 1 instead of s 1 as a terminal). Switching from (G, H) to (G e , H e ) is called a local move. Local moves preserve Eulerianess. If a local move generates a feasible instance then it is called feasible, infeasible otherwise.
Original Paper
Loading high-quality paper...
Comments & Academic Discussion
Loading comments...
Leave a Comment