A Linear-time Algorithm for Integral Multiterminal Flows in Trees

A Linear-time Algorithm for Integral Multiterminal Flows in Trees

Mingyu Xiao School of Computer Science and Engineering, University of Electronic Science and Technology of China, Chengdu, China
myxiao@gmail.com
Hiroshi Nagamochi Department of Applied Mathematics and Physics, Graduate School of Informatics, Kyoto University, Japan
nag@amp.i.kyoto-u.ac.jp
Abstract

In this paper, we study the problem of finding an integral multiflow which maximizes the sum of flow values between every two terminals in an undirected tree with a nonnegative integer edge capacity and a set of terminals. In general, it is known that the flow value of an integral multiflow is bounded by the cut value of a cut-system which consists of disjoint subsets each of which contains exactly one terminal or has an odd cut value, and there exists a pair of an integral multiflow and a cut-system whose flow value and cut value are equal; i.e., a pair of a maximum integral multiflow and a minimum cut. In this paper, we propose an -time algorithm that finds such a pair of an integral multiflow and a cut-system in a given tree instance with vertices. This improves the best previous results by a factor of . Regarding a given tree in an instance as a rooted tree, we define rooted tree instances taking each vertex as a root, and establish a recursive formula on maximum integral multiflow values of these instances to design a dynamic programming that computes the maximum integral multiflow values of all rooted instances in linear time. We can prove that the algorithm implicitly maintains a cut-system so that not only a maximum integral multiflow but also a minimum cut-system can be constructed in linear time for any rooted instance whenever it is necessary. The resulting algorithm is rather compact and succinct.

Multiterminal flow; Maximum flow; Minimum Cut; Trees; Linear-time algorithms
\Copyright

Mingyu Xiao and Hiroshi Nagamochi\subjclassG.2.2 Graph Theory\EventEditorsSeok-Hee Hong \EventNoEds1 \EventLongTitle27th International Symposium Algorithms and Computation (ISAAC 2016) \EventShortTitleISAAC 2016 \EventAcronymISAAC \EventYear2016 \EventDateDecember 12–14, 2016 \EventLocationSydney, Australia \EventLogo \SeriesVolume64 \ArticleNo[42]

1 Introduction

The min-cut max-flow theorem by Ford and Fulkerson [5] is one of the most important theorems in graph theory. It catches a min-max relation between two fundamental graph problems. This theorem leads to many effective algorithms and much theory for flow problems as well as graph cut problems. Due to the great applications of it, researchers have interests to seek more similar min-max formulas in various kinds of flow and cut problems. In this paper, we consider the maximum multiterminal flow problem, a generalization of the basic maximum flow problem.

In the maximum flow problem, we are given two terminals (source and sink) and asked to find a maximum flow between the two terminals. A natural generalization of the maximum flow problem is the famous maximum multicommodity flow problem, in which, a list of pairs of source and sink for the commodities is given and the objective is to maximize the sum of the simultaneous flows in all the source-sink pairs subject to the standard capacity and flow conservation requirements. The maximum multiterminal flow problem is one of the most important special cases of the maximum multicommodity flow problem. In it, a set of more than one terminal is given and the list of source-sink pairs is given by all pairs of terminals in . The extensions of the maximum flow problem have been extensively studied in the history. Readers are referred to a survey [2].

A dual problem of the maximum multiterminal flow problem is the minimum multiterminal cut problem, in which we are asked to find a minimum set of edges whose removal disconnects each pair of terminals in the graph. The minimum multiterminal cut problem is a generalization of the minimum cut problem. When there are only two terminals, the min-cut max-flow theorem shows that the value of the maximum flow equals to the value of the minimum cut in the graph. However, when there are more than two terminals, the equivalence may not hold. Consider a star with three leaves. Each leaf is a terminal and each of the three edges has capacity . The flow value of a maximum multiterminal flow is (a flow of size routed between every pair of the three terminal pairs), whereas the size of a minimum multiterminal cut is . In fact, Cunningham [4] has proved a min-max theory for the pair of problems: The size of a minimum multiterminal cut is at most times of the flow value of a maximum multiterminal flow. A similar min-max theory for the maximum multicommodity flow problem and its dual problem is presented in [6].

In the maximum multiterminal flow problem, each edge is assigned a nonnegative capacity and a flow routed between a terminal pair is allowed to take any feasible fraction, whereas in the integral multiterminal flow problem, a flow is allowed to take a nonnegative integer and we are asked to find a maximum flow under this restriction. Clearly, we can simply assume that all edge capacities of the integral multiterminal flow problem are nonnegative integers. The integral multiterminal flow problem is different from the maximum multiterminal flow problem. We can see in the above example, the flow value of a maximum integral multiterminal flow is . The special case of the integral multiterminal flow problem where all edges have unit capacities is also known as the -path problem, in which we are asked to find the maximum number of edge-disjointed paths between different terminal pairs.

In this paper, we study the maximum multiterminal flow problem in trees and give linear-time algorithms for both fractional and integer versions, which improve the best previous algorithms by a factor of  [3]. Note that the maximum (integral) multicommodity flow problem in trees is NP-hard and there is a -approximation algorithm for it [7].

The rest of the paper is organized as follows. Section 2 introduces basic notations on flows and cuts, and reviews important min-max theorems for fractional and integer versions of maximum multiterminal flow problem. Section 3 discusses instances with rooted trees, and introduces notations necessary to build a dynamic programming method over the set of instances of rooted subtrees of a given instance. Informally “a blocking flow” in a rooted tree instance is defined to be a flow in the tree currently pushing maximal flows among terminals except for the terminal designated as the root. Section 4 shows several properties of blocking flows, and presents a representation of flow values of blocking flows. Section 5 provides a main technical lemma that tells how to compute the representation of flow values of blocking flows and how to construct a maximum flow from the representations. Based on the lemma, Section 6 gives a description of a linear-time algorithm for computing the representations of flow values of blocking flows and constructing a maximum flow from the representations. Finally Section 7 makes some concluding remarks.

2 Preliminaries

This section introduces basic notations on flows and cuts, and reviews important min-max theorems for fractional and integer versions of maximum multiterminal flow problem. Let denote the set of nonnegative reals, and denote the set of nonnegative integers.

Graphs and Instances
We may denote by and the sets of vertices and edges of an undirected graph , respectively. Let denote a simple undirected graph with a vertex set and an edge set , and let and denote the number of vertices and edges in a given graph. Let be a subset of vertices in . Let denote the set of edges with one end-vertex in and the other in , where for a vertex is denoted by . Let denote the graph obtained from by removing the vertices in together with the edges in . For a vertex subset , let be the set of all paths with end-vertices with .

An instance of a maximum flow problem consists of a graph , a set of vertices called terminals, and a capacity function .

Flows
For a function , for a subset is denoted by . A function is called a flow in an instance if there is a function such that

where is the flow value sent along path , and such a function is called a decomposition of a flow . A flow is called integer if it admits a decomposition such that for all paths (note that may not be integer even if for all edges ).

A flow is called feasible if for all edges . The flow value is defined to be , and a feasible flow that maximizes is called maximum.

Cut-Systems
A subset of vertices is called a terminal set (or a -set) if and induces a connected subgraph from . A cut-system of is defined to be a collection of disjoint terminal sets , , where is not required to be a partition of . For a cut-system of , let . For any pair of a feasible flow and a cut-system of in , it holds

(1)

Cherkasskii [1] proved the next result.

{theorem}

A feasible flow in is maximum if and only if there is a cut-system such that .

Ibaraki et al. [9] proposed an -time algorithm for computing a maximum flow in a graph with vertices and edges. Hagerup et al. [8] proved a characterization of the maximum multiterminal flow problem and gave an -time algorithm for the maximum multiterminal flow problem in bounded treewidth graphs, where is an exponential function of the number of terminals. This algorithm runs in linear time only when is restricted to a constant.

An integer version of the multiterminal flow problem is defined as follows. Let have integer capacities , . Recall that an integral flow is a flow which can be decomposed into integer individual flows , i.e., . An instance is called inner-eulerian if all edge capacities , are integers and is an even integer for each non-terminal vertex . It is known that any inner-eulerian instance admits a pair of a maximum integral flow and a cut-system with  [1]. In general, there is no pair of an integral flow and a cut-system with even for trees. We review a min-max theorem on the integer version as follows.

Assume that , . A component in the graph is called an odd set in if is odd. Let denote the number of odd sets in . For each odd set , at least one unit of capacity from cannot be used by any feasible integral flow . Hence since each path in goes through edges in of a -set for exactly two terminals , we see that, for any decomposition of ,

(2)

Mader [10] proved the next result.

{theorem}

A feasible integral flow in is maximum if and only if there is a cut-system such that .

For trees with vertices, an -time algorithm for computing a maximum integral flow is proposed [3], while no strongly-polynomial time algorithm is known to general graphs (e.g., see [2]).

3 Tree Instances

In the rest of this paper, we assume that a given instance consists of a tree , a terminal set and an integer capacity for each . We simply call an integral flow a flow.

This section discusses instances with rooted trees, and introduces notations necessary to build a dynamic programming method over the set of instances of rooted subtrees of a given instance.

If a vertex is not a leaf of , i.e., is of degree , then we can split the instance at the cut-vertex into instances, and it suffices to find a maximum flow in each of these instances. Also we can split a vertex of degree into vertices that induce a tree with edges of capacity sufficiently larger without losing the feasibility and optimality of the instance. In the rest of paper, we assume that is the set of leaves of , and the degree of each non-leaf is 3, and for all edges , as shown in Fig. 1.

For a leaf in , let denote the edge incidenet to . For two vertices , let denote the path connecting and in the tree . For a subset of vertices, let denote the set of all paths with .

In a tree instance , a flow admits a function such that

where is the flow value sent along path . For a flow , a path is called a positive-path if admits a decomposition such that .

For a path in , and an integer (possibly , the function obtained from by setting for all edges and for all edges is denoted by .

Figure 1: An example of a tree instance such that the degree of each internal vertex is 3 and all capacities are positive integers, where terminal is chosen as the root.

Rooted Tree
Choose a terminal , and regard as a tree rooted at , which defines a parent-child relationship among the vertices in . In a rooted tree , we write an edge such that is the parent of by an ordered pair . For an edge , any edge is called a child-edge of , and is called the parent-edge of .

Let be a subset of vertices in such that induces a connected subgraph from . Then there is exactly one edge such that and is the parent of , and we call the edge the parent-edge of while any other edge in is called a child-edge of .

For an edge , let denote the set of vertex and all the descendants of including itself, denote the graph induced from by , and let , where we remark that . Let denote an instance induced from by the vertex subset , where we remark that is included as a terminal in the instance .

Blocking Flows
Informally “a blocking flow” in a rooted tree instance is defined to be a flow in the tree currently pushing maximal flows among terminals except for the terminal designated as the root. Let be a cut-system of in for some edge . An odd set in is called an odd set of a terminal set if the parent-edge of is a child-edge of , where implies . For each terminal set , let denote the family of odd sets of , i.e., of whose parent-edge is a child-edge of . Fig. 2 illustrates a cut-system and the family .

Figure 2: Illustration of a cut-system and the family for a terminal set .

For a function , let denote the set of edges such that .

Let be a feasible flow of for an edge . We call a terminal set with blocked (or blocked by ) if

and call blocked (or blocked by ) if all terminal sets in it are blocked by .

For each vertex , we define to be the set of vertices reachable from by a path from to the common ancestor of and using edges in and by a path from to using edges in . In other words, we travel an edge upward if and downward if from to . By the definition of , we can see that induces a connected subgraph, the parent-edge of satisfies , and any child-edge of satisfies .

We call blocking if is a cut-system of blocked by . Let denote the set of integers such that has a blocking flow .

Interval Computation
Our dynamic programming approach to compute the maximum flow value updates the set of flow values of blocking flows recursively. As it will be shown in Section 4, such a set of flow values always is given by an interval that consists of consecutive odd or even integers, and we here introduce a special operation on such types of intervals.

For two reals with , let denote the set of reals with .

For two integers , the set of consecutive odd or even integers is denoted by , where . For two sets of nonnegative integers, let denote the set of nonnegative integers over all and . In particular, for sets and , we observe that

Given an integer , we can find in time three integers , and such that . To see this, assume that without loss of generality, and let be the minimum element in with , where . Observe that and . Hence if then let and ; otherwise , and .

4 Basic Properties on Blocking Flows

This section shows several properties of blocking flows, and presents a representation of flow values of blocking flows. We first observe two lemmas on some properties of blocking flows.

{lemma}

Let be a feasible flow in for an edge .

  1. For a terminal , let be a -cut such that and be a positive-path of with . If then contains exactly one edge in , and otherwise is disjoint with .

  2. Assume that for any two . Then is disjoint with of any terminal , and the following holds:
    (1) For each edge with ,

    (2) for each .

  3. Flow is blocking if for any two , and for each .

  4. When is blocking, any edge with satisfies .

  5. When is blocking, the parent-edge of any odd set for a terminal satisfies .

Proof. (i) Let be a decomposition of such that for some terminals . Since , we obtain . Hence the positive-path with contains an edge in , then would hold, contradicting . Clearly if then contains exactly one edge in .

(ii) We see that is disjoint with of any terminal , since the vertices in are spanned with edges in and the parent-edge of is saturated by .

Let denote the parent-edge of , , where has no parent-edge in . By construction, the parent-edge of with is saturated by and any child-edge of with satisfies .

We prove (1) and (2) by induction on the size . As the base case where is a terminal such that has no child-edge, i.e., , we see that and and all edges are saturated by , proving (1) and (2) for such a terminal .

Next let be a terminal in such that the properties (1) and (2) are assumed to hold for all -cuts such that and , as an inductive hypothesis. Then the child-edges of any odd set are saturated and thereby the parent-edge of must satisfy since contains no terminal and is odd. Therefore any child-edge of is either the parent-edge of an odd set , where , or the parent-edge of a cut , where holds, proving (1) for . Since or has no parent-edge, this means , proving (1) for the terminal . This completes the inductive proof for the properties (1) and (2).

(iii) Assume that for any two , and for each . Then by the result of (ii), we have holds for all . Since for each , each set with is blocked by , and the family is a cut-system blocked by . Hence is blocking.

(iv) Let , which is blocked by by definition. Let satisfy , where is the parent of , and let be the flow in induced from by . To show , it suffices to prove that is blocking, i.e., is a cut-system of blocked by .

For each terminal , the set includes an ancestor of when the path consists of unsaturated edges, and hence since is saturated by . This means that , which is a cut-system of blocked by .

(v) Let , where is the parent of . It suffices to show that the flow in induced from by is a blocking flow in , i.e., is a cut-system of blocked by .

Since is the parent-edge of odd set , all child-edges of are saturated by by the result of (ii). For each terminal , the set includes an ancestor of when the path consists of unsaturated edges. From these observations, we see that there is no terminal such that , and we have , which is a cut-system of blocked by . ∎

The next lemma tells how to obtain a maximum flow and a minimum cut-system in an instance .

{lemma}

For an edge , let be a blocking flow in such that is the maximum in . Then is a cut-system in satisfying hence is a maximum flow in by 2. Proof. Since is a blocking flow in , the family is a cut-system of blocked by by definition, and we know that for all terminals . First we see that is disjoint with of any terminal , since the vertices in are spanned with edges in and the parent-edge of is saturated by . By Lemma 4(ii), we have .

We now show that . If , then we have and . Consider the case where . We claim that any positive-path for is disjoint with . Assume indirectly that a positive-path contains a vertex in . Let be the branch vertex of and . The function is a feasible flow in , since is spanned with edges in . Since for all edges , the cut-system is blocked also by the flow , and thereby is a blocking flow in with , which contradicts the definition of . Hence any positive-path with is disjoint with . This proves that even if . It always holds that . Therefore we have , as required. ∎

We prove that all edges satisfies the following conditions (a) and (b) by an induction of depth of edges.

(a) is given by with some integers and such that

  1. For each leaf-edge , it holds ;

  2. For each non-leaf-edge with two child-edges and , it holds

    That is, for , where and

    (3)

    where edge (resp., is called dominating if (resp., ), it holds that

    (4)

(b) If has a dominating child-edge , then there is a terminal such that holds for any decomposition of a blocking flow to and consists of dominating edges.

A path consisting of dominating edges is called a dominating path. Fig. 3 shows the pairs and for all edges in the instance in Fig. 1 computed according to (3) and (4).

Figure 3: A pair of integers and in (3) and in (4) for each edge in the instance in Fig. 1, where each pair of and is depicted in bold while that of and in gray. The dominating edges are depicted in thick lines.

Assuming that each edge with depth at least satisfies conditions (a) and (b), we prove that any edge with depth satisfies the statements in the next lemma, which indicates not only conditions (a) and (b) for the edge but also how to construct a blocking flow in from blocking flows in and of the child-edges and of .

5 Main Lemma

This section provides a main technical lemma that tells how to compute the representation of flow values of blocking flows given by conditions (a) and (b), and how to construct a maximum flow from the representations.

{lemma}

Let be a non-leaf-edge with depth . Assume that all edges with depth at least satisfy conditions (a) and (b). For the two children and of , let .

  1. For a blocking flow of , if for some terminal , then the path from to is a dominating path, the path from to satisfies for any decomposition of a blocking flow of , and it holds .

  2. One of the child-edges of is dominating if . Edge satisfies condition (b); if or , say is dominating, then there is a terminal such that holds for any decomposition of a blocking flow of and is a dominating path.

  3. For any integers and such that , and for some integer , let , be a blocking flow of with . Then holds. When , any function with is a blocking flow of .

  4. If admits a blocking flow with , then .

  5. Assume that and is dominating. Let be the dominating path in (iii) and let . There is a blocking flow of with , which can be constructed as

    by choosing a blocking flow of with and a blocking flow of with .

  6. Edge satisfies condition (a); i.e., .

Proof. (i) Let be a blocking flow of such that for some terminal , where . Let be the sequence of edges in such that is the parent-edge of edges and as shown in Fig. 4(a), where and is the edge incident to the terminal , Note that for all by definition of .

Since is blocking, set