Next Article in Journal
Quantitative Trait Loci Mapping Problem: An Extinction-Based Multi-Objective Evolutionary Algorithm Approach
Next Article in Special Issue
Local Search Approaches in Stable Matching Problems
Previous Article in Journal
Extraction and Segmentation of Sputum Cells for Lung Cancer Early Diagnosis
Previous Article in Special Issue
Linear Time Local Approximation Algorithm for Maximum Stable Marriage
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:

Stable Flows over Time

TU Berlin, Institut f¨ur Mathematik, Straße des 17. Juni 136, Berlin 10623, Germany
Author to whom correspondence should be addressed.
Algorithms 2013, 6(3), 532-545;
Submission received: 31 December 2012 / Revised: 27 July 2013 / Accepted: 9 August 2013 / Published: 21 August 2013
(This article belongs to the Special Issue Special Issue on Matching under Preferences)


In this paper, the notion of stability is extended to network flows over time. As a useful device in our proofs, we present an elegant preflow-push variant of the Gale-Shapley algorithm that operates directly on the given network and computes stable flows in pseudo-polynomial time, both in the static flow and the flow over time case. We show periodical properties of stable flows over time on networks with an infinite time horizon. Finally, we discuss the influence of storage at vertices, with different results depending on the priority of the corresponding holdover edges.

1. Introduction

In the stable marriage problem, every vertex of an undirected bipartite graph, G, represents either a woman or a man. Their sympathy for each person of the opposite gender is expressed by their preference lists: the more beloved person has the higher rank. A marriage scheme is a matching, M on G. We say that such a scheme is stable, if there is no pair of participants willing to leave their partners in order to marry each other. More formally: an edge, u v , blocks M, if u and v both are unpaired or prefer each other to their partners in M. A matching M is stable, if there is no blocking edge in G. Gale and Shapley [1] were the first to state that a stable matching always exists. Their well-known deferred-acceptance algorithm finds a stable marriage in strongly polynomial time.
One of the most advanced extensions of the stable marriage problem is the stable allocation problem. It was introduced by Baïou and Balinski [2] in 2002. Here, we talk about jobs and machines instead of men and women. Edges have capacity and participants have quota on their matched edges. This quota stands for the time a job needs to get done and the time a machine is able to work in total. Edges are used for assigning jobs to machines, such that none of the machines spends more time on a job than the edge capacity allows them.
The goal is to find a feasible set of contracts, such that no machine-job pair exists where both could improve their states by breaking the scheme. Edge e is blocking, if it is unsaturated, and neither end vertices of e could fill up its quota with at least as good edges as e. An allocation, x, is stable, if none of the edges of G are blocking. Baïou and Balinski [2] give two algorithms to solve the problem: while their augmenting path algorithm runs in strongly polynomial time, the refined Gale-Shapley algorithm is more efficient in simple cases, e.g., on instances where all jobs get one of their best choices, it only needs sublinear time. Dean et al. [3,4] succeeded in speeding up the first method, relying on sophisticated data structures, such as dynamic trees. They also extended the second one to the case of irrational data.
Stable allocations have been further generalized to stable flows by Ostrovsky [5] and Fleiner [6]. Fleiner also gave a constructive proof for the existence of a stable flow in every network by solving a stable allocation problem in a modified network. In an instance of stable flow, special vertices are designated as terminals, and each non-terminal vertex has a preference list of its incoming and outgoing edges that specifies from which edges it prefers to receive flow and which edges it prefers to send flow along. Stable flows are well suited for modeling real-world market situations, as they capture the different trading preferences of vendors and customers.
We extend this model to the setting of flows over time. Flows over time were introduced by Ford and Fulkerson [7,8]. In addition to the stable flow instance, we have transit times on the edges and a time horizon specifying the end of the process. We prove the existence of stable flows over time and, moreover, show that, for the case of an infinite (or sufficiently large) time horizon, there is a stable flow over time, which converges to a static stable flow. By introducing time to the stable flow setting, one can achieve a considerably more realistic and more interesting description of real market situations. With flows over time and transit times on the edges, we can model transportation problems or illustrate distances amongst the vendors.
Structure of the Paper: In Section 2, we introduce the stable flow problem and present an elegant version of the Gale-Shapley algorithm that operates directly on the given network. We also give a simple proof of its correctness. In Section 3, we present the stable flow over time problem and show the existence of stable flows, even in the case of networks with an infinite time horizon. We conclude the section by analyzing how different variations of storage at vertices can influence the stability of flows in a network.

2. Stable Flows

Although most bipartite matching problems can be easily interpreted as network flow problems, stability was defined for flows only in 2008 by Ostrovsky [5]. He proved the existence and some basic properties of stable flows in acyclic networks. Two years later, Fleiner [6] came up with a generalized setting and further results. In this paper, we use this general setting and build upon Fleiner’s remarkable achievements.

2.1. Basic Notions

We consider a network, ( D , c ) , where D is a directed graph, whose vertices V ( D ) are partitioned into a set of terminals, S V ( D ) , and non-terminal vertices, V ( D ) \ S . Moreover, there is a capacity function, c : E ( D ) R > 0 , on the edges. The digraph, D, might contain multiple edges, as well as loops. This concession forces us to slightly modify the structure of the preference lists: each vertex, v V ( D ) , sets up a strictly ordered list of the neighboring edges instead of the neighboring vertices. For convenience, we consider the orderings on incoming and outgoing edges as two separate lists. The set of these lists are denoted by O. Vertex v prefers u v to w v , if u v has a lower number on v’s preference list than v w . In this case, we say that u v dominates w v at v and denote it by u v < v w v . The same notation is used for outgoing edges.
Definition 2.1 (flow).
A flow, f, in network, ( D , c ) , is a function, f : E ( D ) R 0 , such that the following properties hold:
  • f ( u v ) c ( u v ) for all edges, u v E ( D ) ;
  • u v E ( D ) f ( u v ) = v w E ( D ) f ( v w ) for all vertices, v V ( D ) \ S .
We would like to emphasize that we do not distinguish sources and sinks in S; their role is the same: they are the vertices in D that do not have to obey the Kirchhoff law.
Definition 2.2 (stable flow).
A blocking walk of flow f is a directed walk, W = ( v 1 , e 1 , . . . , e k - 1 , v k ) , such that all of the following properties hold:
  • each edge, e i , i = 1 , . . . , k - 1 , is unsaturated;
  • v 1 S or there is an edge, e = v 1 u , such that f ( e ) > 0 and e 1 < v 1 e ;
  • v k S or there is an edge, e = w v k , such that f ( e ) > 0 and e k - 1 < v k e .
A network flow is stable, if there is no blocking walk in the graph.
The network can be seen as a market situation, where the vertices are the traders and the edges connecting them are possible deals. All participants rank their partners for arbitrary reasons: e.g., quality, price or location. These rankings are the preference lists of our instance. Notice that edges do not necessarily correspond to deals involving the same product, and there may be cycles on the graph, even of a length of two. An unsaturated walk is a possible deal between vendors v 1 and v k . If they are suppliers or consumers (terminals) or can improve their situation using the unsaturated walk, then they will agree to send some flow along it and break the existing scheme.
It was shown by Fleiner [6] that each instance, I , of the stable flow problem can be converted into an equivalent instance, I , of the stable allocation problem, such that every stable flow corresponds to a stable allocation and vice versa. Since there always exists a stable allocation [2], the existence of stable flows directly follows from the equivalence of stability on I and I . The construction shows that stable flows can be found in polynomial time.
Theorem 2.3 
(Fleiner, 2010 [6]). There is a stable flow on every instance, ( D , c , O ) .
Theorem 2.4 
(Fleiner, 2010 [6]). For a fixed instance, each edge incident to a terminal vertex has the same value in every stable flow.
The stable flow problem can be seen as a generalization of the stable allocation problem. We introduce two terminal vertices to G and connect s with all vertices representing jobs and t with all vertices representing a machine. The new edges get the quota of their non-terminal end vertex as capacity. Now, we orient all edges from s to the jobs, from the jobs to the machines and from the machines to t, in order to get a directed network. On this network, all stable flows induce a stable allocation on the original graph and vice versa.

2.2. Algorithms to Find Stable Flows

The stable allocation problem can be solved in polynomial time [2,4]. As mentioned in the introduction, the augmenting path algorithm is not always the most efficient way to find stable allocations; the Gale-Shapley algorithm terminates faster in some cases. It can be run on I in order to give a stable allocation, which yields a stable flow on I . Note that this holds for irrational data, as well. The fact that this method can be directly applied to instance I is briefly mentioned by Fleiner [6]. In the following, we will show how to interpret the direct application of the Gale-Shapley algorithm on the network as a preflow-push-type algorithm and prove its correctness. We will provide two variants, a basic preflow-push variant that is easy to understand and one that resembles the alternating proposal/refusal scheme of the original Gale-Shapley algorithm.
Proposal and refusal pointers: For each vertex, v V ( D ) , the algorithm maintains two pointers, p [ v ] and r [ v ] . The first pointer, p [ v ] , iterates through v’s list of outgoing edges from the highest to the lowest priority edge. It points to that edge along which v is currently willing to offer more flow. Likewise, r [ v ] iterates through v’s list of incoming edges from the lowest to the highest priority edge. It points to that edge that v is going to refuse next, if necessary. For technical reasons, we introduce one more element to each preference list: after passing through all neighbors, p [ v ] reaches a state encoded by p [ v ] = 0 . This means that v cannot submit any more offers. Likewise, r [ v ] = 0 initially, as v has no intention to refuse flow in the beginning.
Initialization: The algorithm starts by saturating all edges leaving the terminal set, i.e., f ( s v ) = c ( s v ) for all s v E ( D ) with s S . We define the excess of a vertex, v, w.r.t. f, by ex ( v , f ) : = u v δ - ( v ) f ( u v ) - v w δ + ( v ) f ( v w ) , where δ - ( v ) denotes the set of incoming edges, while δ + ( v ) stands for the outgoing ones. Note that f initially is not a feasible flow, as ex ( v , f ) > 0 for some non-terminal vertices, v V ( D ) \ S —we will call such vertices active.
Preflow-push variant: The algorithm iteratively selects an active vertex, v V ( D ) , and pushes as much flow as possible along p [ v ] , advancing the proposal pointer whenever the edge is saturated or an already refused edge is encountered. If p [ v ] reaches the zero-state before all excessive flow has been pushed out of the vertex, it continues by decreasing the flow on the incoming edge, r [ v ] , advancing the refusal pointer whenever the flow on the edge reaches zero. After a push operation, the excess of the vertex is zero, and another active vertex is selected. The algorithm terminates once there is no active vertex left. For a pseudo-code listing of this preflow-push approach, see Algorithm 1.
Algorithm 1 Preflow-push algorithm.
  • Initialize p , r . Saturate all edges, leaving S.
  • while v V ( D ) \ S : ex ( v , f ) > 0 do
  •     while ex ( v , f ) > 0 do
  •         if p [ v ] 0 then
  •            propose( p [ v ] )
  •         else
  •            refuse( r [ v ] )
  •         end if
  •     end while
  • end while
Simultaneous variant: An alternative variant that resembles the Gale-Shapley algorithm more closely can be obtained by performing alternating rounds of proposal and refusal steps, respectively, on all active vertices simultaneously (cf., Algorithm 2). This variant of the algorithm will prove useful when analyzing stable flows in a time-expanded network later in this paper.
Algorithm 2 Simultaneous push algorithm.
  • Initialize p , r . Saturate all edges, leaving S.
  • while v V ( D ) \ S : ex ( v , f ) > 0 do
  •     for all v V ( D ) : p [ v ] 0 do
  •         propose( p [ v ] )
  •     end for
  •     for all v V ( D ) : p [ v ] = 0 do
  •         refuse( r [ v ] )
  •     end for
  • endwhile
  • procedurepropose( e = ( v , w ) )
  •     if ( r [ w ] > w e or w S ) and f ( e ) < c ( e ) then
  •          f ( e ) : = min ( f ( e ) + ex ( v , f ) , c ( e ) )
  •     else
  •         advance(p[v])
  •     end if
  • end procedure
  • procedure refuse( e = ( v , w ) )
  •     if r [ w ] 0 and f ( e ) > 0 then
  •          f ( e ) : = max ( f ( e ) - ex ( w , f ) , 0 )
  •     else
  •         advance(r[w])
  •     end if
  • end procedure
A special execution of Algorithm 1 gives the McVitie-Wilson algorithm [9] for the stable marriage problem. We can determine the choice of active vertices, while running Algorithm 1 on the flow instance defined by the stable matching instance. At initialization, the source sends one unit of flow to each vertex, symbolizing a man. The active vertex chosen arbitrarily in the first step is one of them. He proposes along his best edge, and the asked woman accepts the offer and sends the flow further to the sink. Now, the second man will be chosen arbitrarily; he proposes along his best edge. If any woman gets more than one offer, her vertex enters the active set, and she needs to be chosen next. Afterwards, the refused man must play the role of the selected vertex, and so on. This way, we run the deferred-acceptance algorithm by taking the men one by one to the instance, always setting up a current stable matching.
Theorem 2.5. 
If c is integral, both algorithms return an integral stable flow in at most O e E c ( e ) iterations.
The proof is split into three parts:
Claim 1. 
Throughout the course of the algorithms, f is integral.
We prove this by induction. The claim is true after initialization, as the capacities of all edges are integral. Thus, before a call of refuse or propose, the excess of the corresponding vertex is integral, as well. This implies that the flow value of the corresponding edge is changed by an integral amount. ☐
Claim 2. 
Both algorithms terminate after O e E c ( e ) steps.
In each call of propose, the flow value of the corresponding edge is increased by an integral amount (by claim 1), or the pointer p is advanced. Likewise, in each call of refuse, the flow value of the corresponding edge is decreased by an integral amount, or the pointer r is advanced. Once refuse is called for some edge, u v , the flow value cannot be increased by a propose call anymore. Thus, there can be only at most O e E c ( e ) calls of propose and refuse. ☐
Claim 3. 
The algorithms return a stable flow.
After termination, f is a feasible flow, as the excess of every non-terminal vertex is zero. Now, suppose there is a blocking walk in the network. There are two reasons for leaving unsaturated edges in the network: either the edge was refused or there was no proposal along it using all its capacity; it stayed at least partly unexamined. We will study which case can come up at which position in the blocking walk.
If an unsaturated walk starts at a terminal vertex, then the first edge of it has been refused, since s S must try to fill all its adjacent edges with maximum capacity. If the walk ends at a terminal vertex, there was no full proposal along that edge in the algorithm, since terminal vertices do not refuse any flow. If the blocking walk starts at a non-terminal vertex, then there must be a dominated edge starting at the same vertex and having nonzero value. This proves that the unsaturated edge has been refused, because vertices submit offers along edges in their order in the preference list of the start vertex. A similar argument can applied to the end vertex of the blocking walk: there must be a dominated edge ending at the same vertex and having nonzero value. The unsaturated edge can not be a refused one, since we always refuse the worst edges.
The argument above shows that the blocking walk must start with a refused edge and end with a not fully proposed one. This means that along the walk, there has to be at least one refused edge, u v , and an at least partly unexamined one, v w . This implies that vertex v refused flow, although it has not filled up its outgoing quota, a contradiction. ☐
Corollary 2.6. 
If c is rational, both algorithms return a rational stable flow.
Any instance with a rational capacity vector can be transformed to an instance with an integral capacity vector by multiplying all capacities with their smallest common denominator. ☐
A simple network setting can illustrate how large capacities may cause a long running time. Note that this example is the flow extension of the allocation problem described by Baïou and Balinski [2].
Algorithms 06 00532 i001
In the example above, S = s , t , and N is an arbitrary large number. After saturating s v and s u , the simultaneous push algorithm saturates u w and v z and proposes along v w with one unit. This offer will be accepted by w, forcing it to refuse one flow unit along u w . Thus, u has to submit an offer to z, which needs to accept it and reject a flow unit from v. An alternating cycle of new offers and refusals will be made along v , w , u , z , as long as there is any flow to refuse along u w and v z . This means, in total, N augmentations are along the cycle.

3. Flows over Time

3.1. Basic Notions

We are given a network, ( D , c , τ ) , consisting of a directed graph, D, some terminal vertices, S V ( D ) , and a capacity function, c : E ( D ) R > 0 , on the edges. The last element is the transit time function: τ : E ( D ) Z 0 . Besides these, an instance contains a time horizon, T Z > 0 , as well. Loops and multiple edges are allowed in D.
Definition 3.1 (flow over time).
Functions, f e : 0 , 1 , . . . , T - 1 R 0 , for each edge e E ( D ) form a flow over time or dynamic flow with time horizon, T, if they fulfill all of the following requirements:
  • f e ( θ ) = 0 for θ T - τ ( e )
    this ensures that flow can be sent from u along an edge, u v , only if there is enough time left for it to reach v.
  • f e ( θ ) c ( e ) for all e E ( D ) and θ 0 , 1 , . . . , T - 1
    capacity constraints hold all the time.
  • e δ - ( v ) ξ θ - τ ( e ) f e ( ξ ) = e δ + ( v ) ξ θ f e ( ξ ) for all v V ( D ) \ S and θ 0 , 1 , . . . , T - 1
    flow conservation is fulfilled at every point in time.
Any dynamic flow problem can be converted into an ordinary flow problem with the help of the time-expanded network, D T . We create T copies of V ( D ) , with v i denoting the ( i + 1 ) th copy of vertex i. For every edge, u v E ( D ) , and every i { 0 , , T - 1 - τ ( u v ) } , we connect u i with v i + τ ( u v ) . The vertices of D T with a fixed index, i, form a timeslot. Though this construction reduces the flow over time concept to the static setting without transit times, the price of this simplification is a considerably larger time-expanded network, D T , having a size linear in T and, thus, exponential in the input size. This does not always cause a problem: in the maximum dynamic flow problem, there is always a temporally repeated maximum flow that can be found in polynomial time [7,8].
We extend the flow over a time instance to stable flows over time, by introducing preference lists. They have the same behavior as in the stable flow problem, and they do not change in time. The notion of stability can be extended to this instance the following way:
Definition 3.2 (stable flow over time).
A directed walk, W = ( v 1 , e 1 , . . . , e k - 1 , v k ) , is a blocking walk of flow over time, f, if there is a certain point in time, 0 θ T - 1 , such that all the following properties hold:
  • each edge, e i , is unsaturated at time θ + j = 1 i - 1 τ ( e j )
  • v 1 S or there is an edge, e = v 1 u , such that f e ( θ ) > 0 and e 1 < v 1 e
  • v k S or there is an edge, e = w v k , such that f e θ + j = 1 k - 1 τ ( e j ) - τ ( e ) > 0 and e k - 1 < v k e
A blocking walk, W, can be interpreted in a similar way as in the static case: if the two participants symbolized by the end vertices agree that sending some flow along W would improve their situation, then the scheme will be broken by them.
Note that a flow over time is stable, if and only if the corresponding flow in the time-expanded network is stable in the classical sense.
Theorem 3.3. 
For every ( D , c , τ , O ) and time horizon, T Z > 0 , there is a stable flow over time.
A stable static flow exists in the time-expanded network. ☐
Corollary 3.4. 
In every stable flow over time with T Z > 0 , the terminal vertices send and receive the same amount of flow in a fixed timeslot on all edges incident to them.
This follows from Theorem 2.4. ☐
Note that these two statements hold, even if the preference lists may change in time.
Remark 3.5. 
Without loss of generality, we can assume the graph to be simple and free of loops. If an edge, e, is a loop or parallel to another edge, we simply split this edge into two edges, e 1 , e 2 , introducing a new vertex, v e . We assign capacities, c ( e 1 ) = c ( e 2 ) = c ( e ) , and transit times, τ ( e 1 ) = τ ( e ) and τ ( e 2 ) = 0 , to the new edges. As v e is a non-terminal and has only one incoming and one outgoing edge, it will never be the start or end vertex of a blocking walk. Furthermore, any blocking walk visiting v e corresponds to a blocking walk in the original graph using the edge, e, and vice versa.
As a result of this assumption, any propose or refuse operation on a vertex, v i , in the time-expanded network does not effect the state of any other copy, v j , of the same vertex.
Time-expanded variant of the preflow-push algorithm: In order to obtain structural insights on stable flows over time, we will apply Algorithm 1 in the time expanded network using a special order of the vertices: it picks a vertex, v V \ S , from the underlying static network and handles all copies of v, starting at v 0 and ending at v T - 1 , processing each of them as long as it has excessive flow. We will call such a traversal of all copies of a vertex, v, by the algorithm a v-phase.
The following lemma gives important structural insights on the stable flow computed by Algorithm 3, which will prove useful in the following sections.
Algorithm 3 Time-expanded variant of the preflow-push algorithm.
  • Initialize p , r . Saturate all edges, leaving S.
  • while v V \ S : i = 0 T - 1 ex ( v , f ) > 0 do
  •     for i = 0 to T - 1 do
  •         while ex ( v i , f ) > 0 do
  •            if p [ v ] 0 then
  •                propose( p [ v i ] )
  •            else
  •                refuse( r [ v i ] )
  •            end if
  •         end while
  •     end for
  • end while
Lemma 3.6. 
Let i < j . After every u-phase for any vertex, u V \ S , in Algorithm 3, the following statements hold for all v V ( D ) \ S :
p [ v i ] v p [ v j ]
If p [ v i ] = v p [ v j ] = v w and r [ w j + τ ( v w ) ] > w v w (or w S ), then f ( p [ v i ] ) f ( p [ v j ] ) .
r [ v i ] v r [ v j ]
If r [ v i ] = v r [ v j ] 0 , then f ( r [ v i ] ) f ( r [ v j ] ) .
We prove the lemma by induction on the algorithm. Clearly, all statements are true after initialization. We show that they also stay true after the end of each phase.
First, observe that during a u-phase, statements (a) to (d) cannot be invalidated for any vertex, v u : The pointers of v are not changed, so (a) and (c) remain valid for v. The flow on any edge, r [ v i ] , for any i cannot be changed, so (d) remains valid. Finally f ( p [ v i ] ) can only change if p [ v i ] = r [ u ] for some index, , but in this case, (b) is always true. We thus can assume that after a phase of vertex v, statements (a) to (d) are true for all vertices other than v and use this fact to show that they also hold for v.
Let i < j , and consider the pointers of copies of vertex u and the flow on their incident edges after a u-phase. As there are no loops in the underlying graph, the algorithm ensures ex ( u i , f ) = ex ( u j , f ) = 0 . Furthermore:
f ( u i w i + τ ( e ) ) f ( u j w j + τ ( e ) ) for all e = u w E with p [ u i ] > u u w
(if u j w j + τ ( e ) exists) because (c) and (d) hold for vertex w. Likewise,
f ( w i - τ ( e ) u i ) f ( w j - τ ( e ) u j ) for all e = w u E with r [ u j ] > u w u
(if w i - τ ( e ) u i exists) because (a) and (b) hold for w.
Assume, by contradiction, that (a) or (b) is not valid after the phase. This implies r [ u j ] = 0 and, thus, inflow ( u i ) inflow ( u j ) by Equation (2), where inflow ( v ) = u v E ( D ) f ( u v ) . Let p [ u i ] = u e = u w . If (a) is not valid, then the pointer, p [ u i ] , must have been advanced during the phase, and thus, f ( p [ u i ] ) > 0 = f ( u j w j + τ ( e ) ) . The inequality, f ( p [ u i ] ) > f ( u j w j + τ ( e ) ) , is also true if (b) is not valid. In both cases, p [ u i ] u p [ u j ] . Thus, by Equation (1), outflow ( u i ) > outflow ( u j ) . This yields ex ( u i , f ) < ex ( u j , f ) = 0 , a contradiction.
Now, assume, by contradiction, that (c) or (d) is not valid after the phase. This implies p [ u i ] = 0 and, thus, outflow ( u i ) outflow ( u j ) by Equation (1). Let r [ u i ] = u e = w u . If (c) is not valid, then the pointer, r [ u i ] , must have been advanced during the phase, and thus, f ( r [ u i ] ) < f old ( w i - τ ( e ) u i ) f old ( w j - τ ( e ) u j ) , where f old denotes the flow before execution of the phase. The inequality, f ( r [ u i ] ) < f ( w j - τ ( e ) u j ) , is also true, if (d) is not valid. In both cases, r [ u i ] u r [ u j ] . Thus, by Equation (2), inflow ( u i ) < inflow ( u j ) . This again yields ex ( u i , f ) < ex ( u j , f ) = 0 , a contradiction.

3.2. Infinite Time

In this section, we will prove the existence of a stable flow, even if the time horizon is infinite. This flow can be constructed by applying the time-expanded preflow-push algorithm on D (under the assumption that it can apply the propose and refuse steps on all copies of a vertex in finite time). Even more, after a certain point in time, the stable flow is identical to a temporal repetition of the stable flow computed by the same algorithm in the static network, D.
We define D i to be the subgraph induced by the vertices, v j with j > i . We will run Algorithm 1 on D and Algorithm 3 on D in parallel, executing a u-phase in D whenever vertex u is processed in D. (Note that the state of vertex u i does not, in particular, depend on any other vertex copy, u j , with j > i . Therefore, the state of u i and its adjacent edges after the u-phase is well defined, although infinitely many copies of u are processed during the u-phase.) Let f be the flow values in D and f be the flow values in D that occur throughout the run of the algorithm, and let p , r and p , r be the corresponding pointers, respectively.
Our main theorem in this section states that there is a point in time from which on all computations in the infinite time expanded network correspond one-to-one to those in the static network.
Theorem 3.7. 
There is a point in time, 0 i < , such that at the end of every u-phase for any vertex, u, throughout the course of the algorithm, for every j i , f ( v j w j + τ ( v w ) ) = f ( u v ) for all edges v w E ( D ) , and p [ v j ] = v p [ v ] and r [ v j ] = v r [ v ] for all v V ( D ) .
Let τ max : = max e E ( D ) τ ( e ) . We will first prove by induction that until phase K, the statement of the theorem is true for i K : = K · τ max . Clearly, this is true after initialization, as all edges leaving the terminal set are saturated, and all pointers are at their initial state.
Now assume that after phase K, the state of all flow variables and pointers in D i K is identical to that in D. Now, let u V ( D ) \ S be the vertex that is processed in the current phase and let j > i K + 1 . Note that before the execution of the u-phase, all edges incident to u j carry the same flow as all edges incident to u in D (as j - τ max > i K ), and p [ u j ] = p [ u ] and r [ u j ] = r [ u ] . Therefore, the u-phase modifies u j and its incident edges in exactly the same way as u is modified by Algorithm 1 in D. Accordingly, after the end of the u-phase, the statement of the theorem still holds for i K + 1 .
We now have shown that up to phase K, the statement of the theorem holds for i K . Now, let K 0 be the number of iterations performed by Algorithm 1 before f is a stable flow in D. After iteration K 0 , no flow values or pointers in D are changed. Let i : = i K 0 + 1 . We will show that after iteration K 0 , also, no flow values or pointers in D i are changed, which concludes the proof of the theorem.
After iteration K 0 , all vertices in D i are inactive. Thus, their state can only change if the flow value on an edge, v k w l , for k < i and l i , is increased. This can only happen, if f ( v k w l ) < c ( v w ) , as well as r [ w l ] > w v w , and p [ v k ] = v v w . Note that at the end of the phase, K 0 , we have f ( v k + τ max w l + τ max ) = f ( v k w l ) , and r [ w l + τ max ] = w r [ w l ] > w v w , by choice of i = i K 0 + 1 . Now, by Lemma 3.6, p [ v k + τ max ] v p [ v k ] , and as v k + τ max w l + τ max is neither refused nor saturated, p [ v k + τ max ] = v v w = v p [ v k ] . Again, by Lemma 3.6, f ( v k w l ) f ( v k + τ max w l + τ max ) as long as neither p [ v k + τ max ] nor r [ v l + τ max ] are advanced. Therefore, f ( v k w l ) cannot be increased before some vertex in D i becomes active. Thus, f ( v k w l ) is never increased. ☐
Corollary 3.8. 
Algorithm 3 constructs a stable flow, f , in D T , such that f ( v i w i + τ ( v w ) ) = f ( v w ) for all v w E ( D ) and all j ( K 0 + 1 ) · τ max , where K 0 is the number of iterations performed by the Algorithm 1 to compute the stable flow, f, in D, using the same order of vertices.

3.3. Storing at Vertices

The third point in the definition of a flow over time requires flow conservation in every timeslot. A different model allows storing at vertices: a vendor may delay the shipment of goods at his convenience, as long as the flow arrives at the terminal vertices within the time horizon. More formally, we generalize the definition of the excess of vertex v at time θ as the amount of stored goods at vertex v at time θ:
ex f ( v , θ ) : = e δ - ( v ) ξ θ - τ ( e ) f e ( ξ ) - e δ + ( v ) ξ θ f e ( ξ )
While strict flow conservation requires ex f ( v , θ ) = 0 for all non-terminal vertices and times in 0 , . . . , T - 1 , weak flow conservation allows ex f ( v , θ ) 0 , except for time T - 1 , where ex f ( v , T - 1 ) = 0 must hold for all v V ( D ) \ S .
The time-expanded network can be adapted for weak flow conservation by introducing so-called holdover edges, v i v i + 1 , of infinite capacity for each v V ( D ) and i { 0 , . . . , T - 2 } . Setting the ranks of these holdover edges in the preference lists allows the investigation of interesting variations. One intuitive view comes from the fact that storing goods is expensive and people are impatient, thus letting the edges, v i v i + 1 , be the last on v i ’s preference list and the first on v i + 1 ’s preference list. In the following, we will investigate the four main cases with weak flow conservation, given by varying first and last preferences on the end vertices of holdover edges. In each case, we study how the sets of stable flows obeying the different flow conservation rules are related to each other.
We adapt the definition of a blocking walk for the case of intermediate storing. Apart from a starting time, θ, we need the exact time, θ i , when the walk in D leaves a vertex, v i . A walk in D together with a sequence, θ , θ 1 , θ 2 , . . . , θ k , uniquely determines a walk on D T .
Example 3.9. 
Introducing waiting at vertices, stable flows may lose their stability, independent from the rank of holdover edges.
Consider the following example:
Algorithms 06 00532 i002
All edges in the static network have unit capacity and unit transit time; s and t are the non-terminal vertices. The unobvious preferences are shown on the edges. The time-expanded network with T = 5 stands on the right side, showing only the vertices and edges that may be used in a feasible flow. On the static network above, there are three stable flows, each of them uses a different incoming edge of z. If waiting is not allowed, then the dynamic flow shown by the thick edges on the second network is stable, since all unsaturated paths are dominated by it at one end. Adding holdover edges to the time-expanded network breaks the scheme: the walk, { u 1 , w 2 , w 3 , z 4 } (denoted by dashed lines), blocks the flow over time. Note that this is independent of the rank of the holdover edges, since we only need dominance at the ends of the blocking walk. ☐
Theorem 3.10. 
If T is sufficiently large and holdover edges always stand on the first place on preference lists, then there is no stable flow with value zero on all holdover edges.
Suppose there is a stable flow on the time-expanded network that does not use any of the holdover edges. Consider all the copies of an arbitrary non-terminal vertex, v: if there are two of them that have a positive value on some incoming (and outgoing) edges, then holdover edges between them form a walk that blocks the flow. Thus, a stable flow over time passes through an arbitrary non-terminal vertex, at most, once. Regarding the maximal number of edges with positive flow value, this means two edges, at most, per non-terminal vertex, apart from the terminal-terminal edges that do not affect stability—a flow with this property has positive value on at most 2 | V ( D ) \ S | edges in the time-expanded network.
These maximum 2 | V ( D ) \ S | edges have to ensure that there is no unsaturated walk between terminal vertices. If the length (w.r.t. transit times) of the shortest walk is denoted by τ ( W m i n ) , then T - τ ( W m i n ) + 1 is a lower bound for the number of disjoint walks between terminal vertices. In order to saturate at least one edge along these walks, the inequality, 2 | V ( D ) \ S | T - τ ( W m i n ) + 1 , must hold; otherwise, at least one copy of the shortest walk is unsaturated—hence, it blocks the flow. ☐
Remark 3.11. 
Note that holdover edges can be simulated by introducing loops of unit transit time and sufficiently large capacity at every vertex of the underlying static network. By performing the modification explained in Remark 3.5 on these loops, we obtain an equivalent time-expanded network that fulfills the requirements of Lemma 3.6. We will use this observation in the following theorem.
Theorem 3.12. 
If T Z > 0 and the holdover edges stand on the last place on preference lists, then there is a stable flow that has a value of zero on all holdover edges. It can be computed by applying Algorithm 3 on the time-expanded network, with all holdover edges being split according to Remark 3.11.
By contradiction, assume there is a holdover edge with positive flow value at some vertex, v. W.l.o.g., assume i to be minimal with f ( v i v i + 1 ) > 0 . Since the time horizon is finite, there also is a latest point in time j, such that f ( v j v j + 1 ) > 0 .
Since f ( v i v i + 1 ) > 0 , the pointer, p [ v i ] , must already have passed all outgoing non-holdover edges of v i , offering as much flow as the corresponding vertices are willing to accept. Therefore, by Lemma 3.6, the flow on each of these edges must be at least the flow on the corresponding edges of v j + 1 (if they exist). Thus, the total outflow of v i exceeds the total outflow of v j + 1 by at least f ( v i v i + 1 ) . On the other hand, r [ v j + 1 ] points either to zero or the incoming holdover edge, and thus, v j + 1 does not refuse any flow on the regular incoming edges. Again, by Lemma 3.6, the flow on those edges is at least the flow on the corresponding edges of v i . Thus, the total inflow of v j + 1 exceeds the total inflow of v i by at least f ( v j v j + 1 ) . Putting this together yields inflow ( v j + 1 ) - outflow ( v j + 1 ) inflow ( v i ) + f ( v j v j + 1 ) - outflow ( v i ) + f ( v i v i + 1 ) > 0 , contradicting flow conservation. ☐
In the other two cases, when holdover edges are the best for one of the end vertices and the worst for the other one, storing can be used or avoided, depending on the network. There are even networks where all stable flows have positive value on some holdover edges.

4. Conclusions and Open Questions

We introduced stable flows over time, extending the concept of stability to network flows over time. As initial results, we proved the existence of stable flows, both for finite and infinite time horizons. In both cases, a stable flow can be computed in pseudo-polynomial time by applying a preflow-push algorithm operating directly on the flow network. We also showed that the possibility of storage at non-terminal vertices has an effect on the set of stable flows, depending on the preference given to holdover edges in the time-expanded network.
Although this paper provides first structural insights, many questions brought up by the definition of stable flows over time remain open, most prominently, the complexity of the stable flow problem: Is there a polynomial time algorithm for finding a stable flow? As of today, it is not even clear whether a stable flow over time can be encoded in polynomial space. First, research in this direction indicates that at least the concept of (generalized) temporally repeated flows cannot be applied directly.
Additionally, further extension of stability can be studied on a new setting, e.g., special edges or ties on preference lists, as can be extensions of the flow over the time model, e.g., connections to earliest arrival flows. Finally, we conjecture a stronger form of Theorem 3.12: if holdover edges have lowest priority at both the start and end vertex, no stable flow uses storage at non-terminal vertices.


This work was supported by the Berlin Mathematical School and by the DFG Research Center Matheon in Berlin.

Conflicts of Interest

The authors declare no conflict of interest.


  1. Gale, D.; Shapley, L. College admissions and the stability of marriage. Am. Math. Mon. 1962, 1, 9–14. [Google Scholar] [CrossRef]
  2. Baïou, M.; Balinski, M. The stable allocation (or ordinal transportation) problem. Math. Oper. Res. 2002, 27, 485–503. [Google Scholar] [CrossRef]
  3. Dean, B.C.; Goemans, M.X.; Immorlica, N. Finite termination of “augmenting path" algorithms in the presence of irrational problem data. Algorithms - ESA 2006, 268–279. [Google Scholar]
  4. Dean, B.C.; Munshi, S. Faster algorithms for stable allocation problems. Algorithmica 2010, 58, 59–81. [Google Scholar] [CrossRef]
  5. Ostrovsky, M. Stability in supply chain networks. Am. Econ. Rev. 2008, 98, 897–923. [Google Scholar] [CrossRef]
  6. Fleiner, T. On Stable Matchings and Flows. In Proceedings of the 36th International Workshop on Graph-Theoretic Concepts in Computer Science, Crete, Greece, 28–30 June 2010; Springer-Verlag: Berlin/Heidelberg, Germany, 2010; WG’10, pp. 51–62. [Google Scholar]
  7. Ford, L.R.; Fulkerson, D.R. Constructing maximal dynamic flows from static flows. Oper. Res. 1958, 6, 419–433. [Google Scholar] [CrossRef]
  8. Ford, L.R.; Fulkerson, D.R. Flows in Networks; Princeton University Press: Princeton, NJ, USA, 1962. [Google Scholar]
  9. McVitie, D.G.; Wilson, L.B. The stable marriage problem. Commun. ACM 1971, 14, 486–490. [Google Scholar] [CrossRef]

Share and Cite

MDPI and ACS Style

Cseh, Á.; Matuschke, J.; Skutella, M. Stable Flows over Time. Algorithms 2013, 6, 532-545.

AMA Style

Cseh Á, Matuschke J, Skutella M. Stable Flows over Time. Algorithms. 2013; 6(3):532-545.

Chicago/Turabian Style

Cseh, Ágnes, Jannik Matuschke, and Martin Skutella. 2013. "Stable Flows over Time" Algorithms 6, no. 3: 532-545.

Article Metrics

Back to TopTop