A Lineartime Algorithm for Integral Multiterminal Flows in Trees
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 cutsystem 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 cutsystem 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 cutsystem 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 cutsystem so that not only a maximum integral multiflow but also a minimum cutsystem can be constructed in linear time for any rooted instance whenever it is necessary. The resulting algorithm is rather compact and succinct.
Mingyu Xiao and Hiroshi Nagamochi\subjclassG.2.2 Graph Theory\EventEditorsSeokHee 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 mincut maxflow theorem by Ford and Fulkerson [5] is one of the most important theorems in graph theory. It catches a minmax 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 minmax 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 sourcesink 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 sourcesink 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 mincut maxflow 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 minmax 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 minmax 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 edgedisjointed paths between different terminal pairs.
In this paper, we study the maximum multiterminal flow problem in trees and give lineartime 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 NPhard 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 minmax 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 lineartime 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 minmax 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 endvertex 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 endvertices 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.
CutSystems
A subset of vertices is called a terminal set (or a set)
if and induces a connected subgraph from .
A cutsystem of
is defined to be a collection of disjoint terminal sets
, ,
where is not required to be a partition of .
For a cutsystem of ,
let .
For any pair of a feasible flow and a cutsystem of
in , it holds
(1) 
Cherkasskii [1] proved the next result.
A feasible flow in is maximum if and only if there is a cutsystem 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 innereulerian if all edge capacities , are integers and is an even integer for each nonterminal vertex . It is known that any innereulerian instance admits a pair of a maximum integral flow and a cutsystem with [1]. In general, there is no pair of an integral flow and a cutsystem with even for trees. We review a minmax 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.
A feasible integral flow in is maximum if and only if there is a cutsystem such that .
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 cutvertex 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 nonleaf 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 positivepath 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 .
Rooted Tree
Choose a terminal , and regard as
a tree rooted at , which defines a parentchild 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 childedge of ,
and is called the parentedge 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 parentedge of while any other edge in is called a childedge 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 cutsystem of in for some edge .
An odd set in
is called an odd set of a terminal set
if the parentedge of is a childedge of ,
where implies .
For each terminal set ,
let denote the family of odd sets of , i.e.,
of whose parentedge is a childedge of .
Fig. 2 illustrates a cutsystem
and the family .
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 parentedge of satisfies , and any childedge of satisfies .
We call blocking if is a cutsystem 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.
Let be a feasible flow in for an edge .

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

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

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

When is blocking, any edge with satisfies .

When is blocking, the parentedge 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 positivepath 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 parentedge of is saturated by .
Let denote the parentedge of , , where has no parentedge in . By construction, the parentedge of with is saturated by and any childedge 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 childedge, 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 childedges of any odd set are saturated
and thereby the parentedge of must satisfy
since contains no terminal and is odd.
Therefore any childedge of is either the parentedge of an odd set ,
where , or the parentedge of a cut , where
holds, proving (1) for .
Since or has no parentedge,
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 cutsystem 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 cutsystem 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 cutsystem 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 cutsystem of blocked by .
Since is the parentedge of odd set , all childedges 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 cutsystem of blocked by . ∎
The next lemma tells how to obtain a maximum flow and a minimum cutsystem in an instance .
For an edge , let be a blocking flow in such that is the maximum in . Then is a cutsystem in satisfying hence is a maximum flow in by 2. Proof. Since is a blocking flow in , the family is a cutsystem 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 parentedge 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 positivepath for is disjoint with . Assume indirectly that a positivepath 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 cutsystem is blocked also by the flow , and thereby is a blocking flow in with , which contradicts the definition of . Hence any positivepath 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

For each leafedge , it holds ;

For each nonleafedge with two childedges 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 childedge , 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).
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 childedges 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.
Let be a nonleafedge with depth . Assume that all edges with depth at least satisfy conditions (a) and (b). For the two children and of , let .

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 .

One of the childedges 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.

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 .

If admits a blocking flow with , then .

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 .

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 parentedge 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