Graph Theory App To Economics
Graph Theory App To Economics
What is a Graph?
Often, we associate weights to edges of the graph or digraph. These weights can represent
capacity, length, cost etc. of an edge. Formally, a weight is a mapping from set of edges to
real numbers, w : E R. Notice that weight of an edge can be zero or negative also. We
will learn of some economic applications where this makes sense. If a weight system is given
for a (di)graph, then we write (N, E, w) as the (di)graph.
1.1
If {i, j} E, then i and j are called end points of this edge. The degree of a vertex is
the number of edges for which that vertex is an end point. So, for every i N, we have
deg(i) = #{j N : {i, j} E}. In Figure 1, degree of vertex 2 is 3. Here is a simple lemma
about degree of a vertex.
Lemma 1 The number of vertices of odd degree is even.
Proof : Let O be the set of vertices of odd degree. Notice that if we take the sum of the
P
degrees of all vertices, we will count the number of edges exactly twice. Hence, iN deg(i) =
P
P
P
2#E. Now, iN deg(i) = iO deg(i) + iN \O deg(i). Hence, we can write,
X
X
deg(i) = 2#E
deg(i).
iO
iN \O
Now, right side of the above equation is even. This is because 2#E is even and for every
P
i N \ O, deg(i) is even by definition. Hence, left side of the above equation iO deg(i) is
even. But for every i O, deg(i) is odd by definition. Hence, #O must be even.
3
A path is a sequence of distinct vertices (i1 , . . . , ik ) such that {ij , ij+1 } E for all
1 j < k. The path (i1 , . . . , ik ) is called a path from i1 to ik . A graph is connected if there
is a path between every pair of vertices. The middle graph in Figure 1 is not connected.
A cycle is a sequence of vertices (i1 , . . . , ik , ik+1 ) with k > 2 such that {ij , ij+1 } E for
all 1 j k, (i1 , . . . , ik ) is a path, and i1 = ik+1 . In the leftmost graph in Figure 1, a path
is (1, 2, 3) and a cycle is (2, 3, 4, 2).
A graph G = (N , E ) is a subgraph of graph G = (N, E) if =
6 N N, E E, and
for every {i, j} E we have i, j N . A connected acyclic (that does not contain a cycle)
graph is called a tree. Graphs in Figure 1 are not trees, but the second and third graph
in Figure 3 are trees. A graph may contain several trees (i.e. connected acyclic subgraphs).
The spanning tree of a connected graph is a subgraph (N, E ) such that (N, E ) is a tree.
Note that E E and a spanning tree does not contain a cycle. By definition, every tree
(N , E ) is a spanning tree of graph (N , E ).
Figure 3 shows a connected graph (which is not a tree) and two of its spanning trees.
4
2.1
Proof :
1. Suppose there are at least two paths from i to j. Let these two paths be P1 =
(i, i1 , . . . , ik , j) and P2 = (i, j 1 , . . . , j q , j). Then, consider the following sequence of
vertices: (i, i1 , . . . , ik , j, j q , . . . , j 1 , i). This sequence of vertices is a cycle or contains a
cycle if both paths share edges, contradicting the fact that G is a tree.
2. Consider an edge {i, j} E \ E . In graph G , there was a unique path from i to j.
The edge {i, j} introduces another path. This means the graph G = (N , E {i, j})
is not a tree (from the claim above). Since G is connected, it must contain a cycle.
3. Let {i, j} E be the edge removed from G . By the first claim, there is a unique path
from i to j in G . Since there is an edge between i and j, this unique path is the edge
{i, j}. This means by removing this edge we do not have a path from i to j, and hence
the graph is no more connected.
4. We do this using induction on number of vertices. If there are two vertices, the claim
is obvious. Consider a tree with n vertices. Suppose the claim is true for any tree
with < n vertices. Now, consider any edge {i, j} in the tree. By (1), the unique path
between i and j is this edge {i, j}. Now, remove this edge from the tree. By (3), we
disconnect the tree into trees which has smaller number of vertices. Each of these trees
have either a single vertex or have two vertices with degree one (by induction). By
connecting edge {i, j}, we can increase the degree of one of the vertices in each of these
trees. Hence, there is at least two vertices with degree one in the original graph.
5. For #N = 2, it is obvious. Suppose the claim holds for every #N = m. Now, consider
a tree with (m + 1) vertices. By the previous claim, there is a vertex i that has degree
1. Let the edge for which i is an endpoint be {i, j}. By removing i, we get another
tree of subgraph (N \ {i}, E \ {i, j}). By induction, number of edges of this tree is
m 1. Since, we have removed one edge from the original tree, the number of edges
in the original tree (of a graph with (m + 1) vertices) is m.
We prove two more important, but straightforward, lemmas.
Lemma 2 Let G = (N, E) be a graph and G = (N, E ) be a subgraph of G such that
#E = #N 1. If G has no cycles then it is a spanning tree.
Proof : Call a subgraph of a graph G a component of G if it is maximally conntected, i.e.,
G = (N , E ) is a component of G = (N, E) if G is connected and there does not exist
vertices i N and j N \ N such that {i, j} E.
5
Clearly, any graph can be partitioned into its components with a connected graph having
one component, which is the same graph. Now, consider a cycle-free graph G = (N, E ) and
let G1 , . . . , Gq be the components of G with number of vertices in component Gj being nj
for 1 j q. Since every component in a cycle-free graph is a tree, by Proposition 1 the
number of edges in component Gj is nj 1 for 1 j q. Since the components have no
vertices and edges in common, the total number of edges in components G1 , . . . , Gq is
(n1 1) + . . . + (nq 1) = (n1 + n2 + . . . + nq ) q = #N q.
By our assumption in the claim, the number of edges in G is #N 1. Hence, q = 1, i.e.,
the graph G is a component, and hence a spanning tree.
Lemma 3 Let G = (N, E) be a graph and G = (N, E ) be a subgraph of G such that
#E = #N 1. If G is connected, then it is a spanning tree.
Proof : We show that G has no cycles, and this will show that G is a spanning tree. We
do the proof by induction on #N. The claim holds for #N = 2 and #N = 3 trivially.
Consider #N = n > 3. Suppose the claim holds for all graphs with #N < n. In graph
G = (N, E ), there must be a vertex with degree 1. Else, every vertex has degree at least two
(it cannot have degree zero since it is connected). In that case, the total degree of all vertices
is 2#E 2n or #E = n 1 n, which is a contradiction. Let this vertex be i and let {i, j}
be the unique edge for which i is an endpoint. Consider the graph G = (N \{i}, E \{{i, j}}).
Clearly, G is connected and number of edges in G is one less than n 1, which equals the
number of edges in E \ {{i, j}}. By our induction hypothesis, G has no cycles. Hence, G
cannot have any cycle.
Consider a graph G = (N, E, w), i.e., a weighted graph. Assume G to be connected. Imagine
the weights to be costs of traversing an edge. So, w R#E
+ . The minimum cost spanning
tree (MCST) problem is to find a spanning tree of minimum cost in graph G. Figure 4
shows a weighted graph. In this figure, one can imagine one of the vertices as source (of
water) and other vertices to be cities. The weights on edges may represent cost of supplying
water from one city to another. In that case, the MCST problem is to find a minimum cost
arrangement (spanning tree) to supply water to cities.
There are many greedy algorithms that find an MCST. We give a generic algorithm, and
show one specific algorithm that falls in this generic class.
The generic greedy algorithm grows an MCST one edge at a time. The algorithm manages
a subset A of edges that is always a subset of some MCST. At each step of the algorithm, an
6
1
3
2
1
4
1
3
2
2
4. Consider the cut (V (A), N \ V (A)). Let {i, j} be a light edge of this cut.
5. Set A A {{i, j}} and repeat from Step 3.
This algorithm produces an MCST. To see this, by Theorem 1, in every step of the
algorithm, we add an edge which is safe. This means the output of the algorithm contains
#N 1 edges and no cycles. By Lemma 2, this is a spanning tree. By Theorem 1, this is
an MCST.
We apply this algorithm to the example in Figure 4. In the first iteration of the algorithm,
we choose vertex a and consider the cut ({a}, {b, c, d}). A light edge of this cut is {a, c}. So,
we set A = {{a, c}}. Then, we consider the cut ({a, c}, {b, d}). A light edge of this cut is
{a, d}. Now, we set A = {{a, c}, {a, d}}. Then, we consider the cut ({a, c, d}, {b}). A light
edge of this cut is {b, d}. Since (N, {a, c}, {a, d}, {b, d}) is a spanning tree, we stop. The
total weight of this spanning tree is 1 + 2 + 1 = 4, which gives the minimum weight over all
spanning trees. Hence, it is an MCST.
4.1
Cooperative Games
Let N be the set of agents. A subset S N of agents is called a coalition. Let be the set
of all coalitions. A cooperative game is a tuple (N, c) where N is a finite set of agents and
c is a characteristic function defined over set of coalitions , i.e., c : R. The number
c(S) can be thought to be the cost incurred by coalition S when they cooperate 2 .
The problem is to divide the total cost c(N) amongst the agents in N when they cooperate. We give an example of a cooperative game and analyze it below. Before that, we
describe a well known solution concept of core.
A cost vector x assigns every player a cost in a game (N, c). The core of a cooperative
game (N, c) is the set of cost vectors which satisfies a stability condition.
Core(N, c) = {x R#N :
xi = c(N),
iN
xi c(S) S ( N}
iS
Cooperative games can be defined with value functions also, in which case notations will change, but
ideas remain the same.
2
1
2
0
3
4
2
1
4.2
The minimum cost spanning tree game (MCST game) is defined by set of agents N =
{1, . . . , n} and a source agent to whom all the agents in N need to be connected. The
underlying graph is (N {0}, E, c) where E = {{i, j} : i, j N {0}, i 6= j} and c(i, j)
denotes the cost of edge {i, j}. For any S N, let S + = S {0}. When a coalition of
agents S connect to source, they form an MCST using edges between themseleves. Let c(S)
be the total cost of an MCST when agents in S form an MCST with the source. Thus, (N, c)
defines a cooperative game.
An example is given in Figure 6. Here N = {1, 2, 3} and c(123) = 4, c(12) = 4, c(13) =
3, c(23) = 4, c(1) = 2, c(2) = 3, c(3) = 4. It can be verified that x1 = 2, x2 = 1 = x3 is in the
core. The next theorem shows that this is always the case.
For any MCST (N, T ), let {p(i), i} be the last edge in the unique path from 0 to agent i.
Define xi = c(p(i), i) for all i N. Call this the Bird allocation - named after the inventor
of this allocation.
Figure 7 gives an example with 5 agents (the edges not show have very high cost). The
MCST is shown with red edges in Figure 7. To compute Bird allocation of agent 1, we
observe that the last edge in the unique path from 0 to 1 in the MCST is {0, 1}, which has
cost 5. Hence, cost allocation of agent 1 is 5. Consider agent 2 now. The unique path from
0 to 2 in the MCST has edges, {0, 3} followed by {3, 2}. Hence, the last edge in this path
10
8
5
6
3
6
7
iN
Let (N, T ) be an MCST for which the Bird allocation x is defined. Delete for every i S,
the edge ei = {p(i), i} (last edge in the unique path from 0 to i) from the MCST (N, T ).
Let this new graph be (N, T). Then, consider the MCST corresponding to nodes S + (which
only use edges having endpoints in S + ). Such an MCST has #S edges by Proposition 1.
Add the edges of this tree to (N, T). Let this graph be (N, T ). Note that (N, T ) has the
same number (#N 1) edges as the MCST (N, T ). We show that (N, T ) is connected. It
is enough to show that there is a path from source 0 to every vertex i N. We consider two
cases.
Case 1: Consider any vertex i S. We have a path from 0 to i in (N, T ) by the MCST
corresponding S + .
Case 2: Consider any vertex i
/ S. Consider the path in (N, T ) from 0 to i. Let k be the
last vertex in this path such that k S. So, all the vertices from k to i are not in S in the
path from 0 to i. If no such k exists, then the path from 0 to i still exists in (N, T ). Else,
we know from Case 1, there is a path from 0 to k in (N, T ). Take this path and go along
the path from k to i in (N, T ). This defines a path from 0 to i in (N, T ).
This shows that (N, T ) is connected and has #N 1 edges. By Lemma 3, (N, T ) is a
spanning tree.
P
Now, the new spanning tree has cost c(N) iS xi + c(S) < c(N) by assumption. This
violates the fact that the original tree is an MCST.
If there are more than one Bird allocations, each of them belongs to the core. Moreover,
any convex combination of these Bird allocations is also in the core (this is easy to verify,
and left as an exercise).
Consider an economy with a finite set of houses H and a finite set of buyers B with #B
#H. We want to find if houses and buyers can matched in a compatible manner. For every
buyer i B, a set of houses =
6 Hi are compatible. Every buyer wants only one house from
his compatible set of houses. We say buyer i likes house j if and only if j Hi . This can be
represented as a bipartite graph with vertex set H B and edge set E = {{i, j} : i B, j
Hi }. We will denote such a bipartite graph as G = (H B, {Hi }iB ).
We say two edges {i, j}, {i , j } in a graph are disjoint if i, j, i , j are all distinct, i.e.,
the endpoints of the edges are distinct. A set of edges are disjoint if every pair of edges in
that set are disjoint. A matching in graph G is a set of edges which are disjoint. We ask
whether there exists a matching with #B edges, i.e., where all the buyers are matched.
12
Figure 9 shows a bipartite graph with a matching: {{1, b}, {2, a}, {3, d}, {4, c}}.
1
l buyers. Since we have removed one house and one buyer from G to form G and since
#S #D(S) 1 for all =
6 S ( B, we will satisfy the condition in the theorem for graph
We saw in the last section that matching all buyers in a bipartite matching problem requires
a combinatorial condition hold. In this section, we ask the question - what is the maximum
number of matchings that is possible in a bipartite graph? We will also discuss an algorithm
to compute such a maximum matching.
6.1
M-Augmenting Path
We start with the notion of augmenting path in an arbitrary undirected graphs. To remind,
in a graph G = (N, E), a matching M E is a set of disjoint edges in G. Here, one can
think of nodes in G to be students, the set of edges to be set of possible pairings of students.
The problem of finding roommates for students can be thought to be a problem of finding a
matching (of maximum size) in G. Figures 10 and 11 show two matchings in a graph - dark
edges represent a matching.
Before we introduce the definition of an augmenting path, we introduce some terminology.
The length of a path (cycle) is the number of edges in a path (cycle). Given a graph
G = (N, E), a set of vertices S N is covered by a set of edges X E if every vertex
14
4
1
4
1
4
1
4
1
partition G into components. Each component has to be either an isolated vertex or a path
or a cycle. Note that every cycle must contain equal number of edges from M and M . Since
the number of edges in M is larger than that in M, there must exist a component of G
which is a path and which contains more edges from M than from M. Such a path forms
an M-augmenting path. This is a contradiction.
Theorem 4 suggests a simple algorithm for finding a maximum matching. The algorithm
starts from some arbitrary matching, may be the empty one. Then, it searches for an
augmenting path of this matching. If there is none, then we have found a maximum matching,
else the augmenting path gives us a matching larger than the current matching, and we
repeat. Hence, as long as we can find an augmenting path for a matching, we can find a
maximum matching.
6.2
17
6.3
The size of a maximum matching in a graph is the number of edges in the maximum
matching. We define vertex cover now and show its relation to matching. In particular, we
show that the minimum vertex cover and the maximum matching of a bipartite graph have
the same size.
18
4
1
Proof : Any vertex cover contains at least one end point of every edge of a matching. Hence,
consider the maximum matching. A vertex cover will contain at least one vertex from every
edge of this matching. This implies that for every graph G, (G) (G).
Lemma 5 can hold with strict inequality in general graphs. Consider the graph in Figure
17. A minimum vertex cover, as shown with black vertices, has two vertices. A maximum
matching, as shown with the dashed edge, has one edge.
1
Figure 18: Matching number and vertex cover number in bipartite graphs
Figure 18 shows a bipartite graph and its maximum matching edges (in dark) and minimum vertex cover (in dark). For the bipartite graph in Figure 18 the matching number (and
the vertex cover number) is two.
20
We will require the following useful result for proving Theorem 5. A graph may have
multiple maximum matchings. The following result says that there is at least one vertex
which is covered by every maximum matching if the graph is bipartite.
Lemma 6 Suppose G = (N, E) is a bipartite graph with E 6= . Then, there exists a vertex
in G which is covered by every maximum matching.
Proof : Assume for contradiction that every vertex is not covered by some maximum matching. Consider any edge {i, j} E. Suppose i is not covered by maximum matching M and
j is not covered by maximum matching M . Note that j must be covered by M - else adding
{i, j} to M gives another matching which is larger in size than M. Similarly, i must be
covered by M . Note that the edge {i, j} is not in (M M ).
Consider the graph G = (N, M M ). A component of G must contain i (since M
covers i). Such a component will have alternating edges in and out of M and M . Since i
is covered by M and not by M, i must be an end point in this component. Further, this
component must be a path - denote this path by P . Note that P contains alternating edges
from M and M (not in M). The other endpoint of P must be a vertex k which is covered by
M - else, P defines an M-augmenting path, contradicting that M is a maximum matching
by Theorem 4. This also implies that k is not covered by M and P has even number of
edges.
We argue that P does not contain j. Suppose P contains j. Since j is covered by M and
not by M , j must be an endpoint of P . Since G is bipartite, let N = B L and every edge
{u, v} E is such that u B and v L. Suppose i B. Since the number of edges in P is
even, both the end points of P must be in B. This implies that j B. This contradicts the
fact that {i, j} is an edge in G.
So, we conclude that j is not in P . Consider the path P formed by adding edge {i, j}
to P . This means j is an end point of P . Note that j is not covered by M and the other
endpoint k of P is also not covered by M . We have alternating edges in and out of M in
P . Hence, P defines an M -augmenting path. This is a contradiction by Theorem 4 since
M is a maximum matching.
Proof of Theorem 5
Proof : We use induction on number of vertices in G. The theorem is clearly true if G has
one or two vertices. Suppose the theorem holds for any bipartite graph with less than n
vertices. Let G = (N, E) be a bipartite graph with n vertices. By Lemma 6, there must
exist a vertex i N such that every maximum matching of G must cover i. Let E i be the
set of edges in G for which i is an endpoint. Consider the graph G = (N \ {i}, E \ E i ). Note
that G is bipartite and contains one less vertex. Hence, (G ) = (G ).
21
22
A directed graph is defined by a triple G = (N, E, w), where N = {1, . . . , n} is the set
of n nodes, E {(i, j) : i, j N} is the set of edges (ordered pairs of nodes), and w is a
vector of weights on edges with w(i, j) R denoting the weight or length of edge (i, j) E.
Notice that the length of an edge is not restricted to be non-negative. A complete graph is
a graph in which there is an edge between every pair of nodes.
3
5
3
10
a
4
c
length of the cycle (c, d, e, c) is 1 + (2) + 2 = 1. The possible paths from a to f with their
corresponding lengths are:
(a, f ): 10.
(a, b, f ): 5 + 3 = 8.
(a, b, d, e, f ): 5 + (3) + (2) + 4 = 4.
(a, c, d, e, f ): 4 + 1 + (2) + 4 = 7.
Hence, s(a, f ) = 4, and the shortest path from a to f is (a, b, d, e, f ).
Here is a useful lemma.
Lemma 7 Suppose (i, i1 , . . . , ik , j) is the shortest path from i to j in the digraph G =
(N, E, w). If G has no cycles of negative length, then for every ip {i1 , . . . , ik }, s(i, ip ) +
s(ip , j) = s(i, j).
Proof : Let P1 = (i, i1 , . . . , ip ) and P2 = (ip , . . . , ik , j). We show that l(P1 ) = s(i, ip ) and
l(P2 ) = s(ip , j), and this will establish the claim.
By the definition of the shortest path, s(i, ip ) l(P1 ). Assume for contradiction, s(i, ip ) <
l(P1 ). This implies that there is some other path P3 from i to ip which is shorter than P1 .
If P3 does not involve any vertex from P2 , then P3 and P2 define a path from i to j, and
l(P3 ) + l(P2 ) < s(i, j). But this contradicts the fact that (i, i1 , . . . , ik , j) is a shortest path.
If P3 involves a vertex from P2 , then P3 and P2 will include cycles, which have non-negative
length. Removing these cycles from P2 and P3 will define a new path from i to j which has
shorter length. This is again a contradiction.
A similar argument works if s(ip , j) < l(P2 ).
7.1
Potentials
w(i,j)
p(i)
p(j)
p(i) + w(i,j) >= p(j)
Figure 21: Idea of potentials
k1
p(i ) p(i
) w(ik1 , ik )
0
1
1
4
3
0
4
Figure 22: A directed graph and the new graph with the dummy vertex
25
We claim that s(0, j) for all j N defines a potential of graph G. Consider any (i, j) E.
We consider two cases.
Case 1: The shortest path from 0 to i does not include vertex j. Now, by definition of
shortest path s(0, j) s(0, i) + w(i, j). Hence, s(0, j) s(0, i) w(i, j).
Case 2: The shortest path from 0 to i includes vertex j. In that case, s(0, i) = s(0, j)+s(j, i)
(by Lemma 7). Hence, s(0, i) + w(i, j) = s(0, j) + s(j, i) + w(i, j). But the shortest path from
j to i and then edge (i, j) creates a cycle, whose length is given by s(j, i) + w(i, j). By our
assumption, s(j, i) + w(i, j) 0 (non-negative cycle length). Hence, s(0, i) + w(i, j) s(0, j)
or s(0, j) s(0, i) w(i, j).
In both cases, we have shown that s(0, j) s(0, i) w(i, j). Hence s(0, j) for all j N
defines a potential of graph G.
An alternate way to prove this part of the theorem is to construct G slightly differently.
Graph G still contains a new dummy vertex but new edges are now from vertices in G to
the dummy vertex 0. In such G , there is a path from every vertex in N to 0. Moreover, G
contains no cycle of negative length if G contains no cycle of negative length. We claim that
s(j, 0) for all j N defines a potential for graph G. Consider any (i, j) E. We consider
two cases.
Case 1: The shortest path from j to 0 does not include vertex i. Now, by definition of
shortest path s(i, 0) w(i, j) + s(j, 0). Hence, s(j, 0) (s(i, 0)) w(i, j).
Case 2: The shortest path from j to 0 includes vertex i. In that case, s(j, 0) = s(j, i)+s(i, 0).
Hence, s(j, 0) + w(i, j) = s(j, i) + w(i, j) + s(i, 0). But s(j, i) + w(i, j) is the length of
cycle created by taking the shortest path from j to i and then taking the direct edge (i, j).
By our assumption, s(j, i) + w(i, j) 0. Hence, s(j, 0) + w(i, j) s(i, 0), which gives
s(j, 0) (s(i, 0)) w(i, j).
The proof of Theorem 6 shows a particular potential when it exists. It also shows an
elegant way of verifying when a system of inequalities (of the potential form) have a solution.
Consider the following system of inequalities. Inequalities of this form are called difference
26
2
1
3
3
4
1
Proof : The proof is similar to the second part of proof of Theorem 6 - the only difference
being we do not need to construct the new graph G and work on graph G directly.
Figure 24 gives an example of a complete directed graph. It can be verified that this
graph does not have a cycle of negative length. Now, a set of potentials can be computed
using Theorem 7. For example, fix vertex 2. One can compute s(1, 2) = 3 and s(3, 2) = 4.
Hence, (3, 0, 4) is a potential of this graph. One can also compute s(2, 1) = 2 and
s(2, 3) = 3, which gives (2, 0, 3) to be another potential of this graph.
1
1
2
3
3
2
Unique Potentials
We saw that given a digraph G = (N, E, w), there may exist many potentials. Indeed, if p
is a potential, then so is q, where q(j) = p(j) + for all j N and R is some constant.
There are other ways to construct new potentials from a given pair of potentials. We say
a set of n-dimensional vectors X Rn form a lattice if x, y X implies x y, defined by
(x y)i = min(xi , yi) for all i, and x y, defined by (x y)i = max(xi , yi ) for all i both
belong to X. We give some examples of lattices in R2 . The whole of R2 is a lattice since if
we take x, y R2 , x y and x y is also in R2 . Similarly, R2+ is a lattice. Any rectangle in
R2 is also a lattice. However, a circular disk in R2 is not a lattice. To see this, consider the
circular disk at origin of unit radius. Though x = (1, 0) and y = (0, 1) belong to this disk,
x y = (1, 1) does not belong here.
The following lemma shows that the set of potentials of a digraph form a lattice.
Lemma 8 The set of potentials of a digraph form a lattice.
Proof : If a graph does not contain any potentials, then the lemma is true. If a graph
contains a potential, consider two potentials p and q. Let p (i) = min(p(i), q(i)) for all
28
i N. Consider any edge (j, k) E. Without loss of generality, let p (j) = p(j). Then
p (k) p (j) = p (k) p(j) p(k) p(j) w(j, k) (since p is a potential). This shows that
p is a potential.
Now, let p (i) = max(p(i), q(i)) for all i N. Consider any edge (j, k) E. Without
loss of generality let p (k) = p(k). Then p (k) p (j) = p(k) p (j) p(k) p(j) w(j, k)
(since p is a potential). This shows that p is a potential.
This shows that there is more structure shown by potentials of a digraph. It is instructive
to look at a complete graph with two vertices and edges of length 2 and 1. Potentials exist
in this graph. Dashed regions in Figure 25 shows the set of potentials of this graph. Note
that if edge lengths were 1 and 1, then this figure would have been the 45-degree line
passing through the origin.
p(2)
p(2) p(1) =1
p(1) p(2) = 2
p(1)
the p above is no longer a potential. Indeed, now we can verify that potential equivalence is
satisfied. These insights are summarized in the following result.
Theorem 8 A strongly connected digraph G = (N, E, w) satisfies potential equivalence if
and only if s(j, k) + s(k, j) = 0 for all j, k N.
Proof : Suppose the digraph G satisfies potential equivalence. Then consider the potentials
of G by taking shortest paths from j and k - denote them by p and q respectively. Then we
have
p(j) q(j) = p(k) q(k)
or s(j, j) s(k, j) = s(j, k) s(k, k),
where p(j) = s(j, j) = 0 = p(k) = s(k, k). So, we have s(j, k) + s(k, j) = 0.
Now, suppose s(j, k) + s(k, j) = 0 for all j, k N (note that such a digraph will always
have cycles of non-negative length, and hence will have potentials). Consider the shortest
path from j to k. Let it be (j, j 1 , . . . , j q , k). Consider any potential p of G. We can write
s(j, k) = w(j, j 1 ) + w(j 1 , j 2 ) + . . . + w(j q , k)
p(j 1 ) p(j) + p(j 2 ) p(j 1 ) + . . . + p(k) p(j q )
= p(k) p(j).
Hence, we get p(k)p(j) s(j, k). Similarly, p(j)p(k) s(k, j) or p(k)p(j) s(k, j) =
s(j, k). This gives, p(k) p(j) = s(j, k). Hence, for any two potentials p and q we have
p(k) p(j) = q(k) q(j) = s(j, k).
It is instructive to look at the right digraph in Figure 27. One can verify that p(0) =
0, p(1) = 0, p(2) = 0.5 is a potential of this digraph. Another potential can be obtained
by taking shortest paths from vertex 1: q(0) = 0.5, q(1) = 0, q(2) = 0.5. Notice that p and
q do not differ by constant. So this digraph fails potential equivalence. This can also be
observed by noting that s(0, 1) = 0 and s(1, 0) = 0.5 - so by Theorem 8 potential equivalence
must fail in this digraph.
i gets good j, he has to pay the price of good j. A matching is a bijective mapping
: N M, where (i) M denotes the good assigned to agent i. Also, 1 (j) denotes the
agent assigned to good j in matching . Given a price vector p, a matching generates a
net utility of vi(i) p((i)) for agent i.
Definition 6 A matching can be fairly priced if there exists p such that for every i N,
vi(i) p((i)) vi(j) p((j))
j N \ {i}.
iN
vi(i)
iN
Consider another example with 3 agents and 3 goods with valuations as shown in Table
1. The efficient matching in this example is: agent i gets good i for all i {1, 2, 3}.
Theorem 9 A matching can be fairly priced if and only if it is efficient.
The proof of this fact comes by interpreting the fairness conditions as potential inequalities. For every matching , we associate a complete digraph G with set of nodes equal to
the set of goods M. The digraph G is a complete digraph, which means that there is an
31
v1
v2
v3
1
4
2
1
2
2
5
4
3
5
3
3
2
2
j N \ {i}.
Hence, can be fairly priced if and only if G has no cycles of negative length.
Without loss of generality, reindex the objects such that (i) = i for all i N. Now,
look at an arbitrary cycle C = (i1 , i2 , . . . , ik , i1 ) in G . Denote by R = N \ {i1 , . . . , ik }. The
length of the cycle C in G is
w(i1 , i2 ) + w(i2 , i3 ) + . . . + w(ik , i1 ) = [vi2 i2 vi2 i1 ] + [vi3 i3 vi3 i2 ] + . . . + [vi1 i1 vi1 ik ]
=
k
X
r=1
k
X
vir ir +
r=1
X
hR
vhh
hR
P
P
Note that kr=1 vir ir + hR vhh is the total value of all agents in matching . Denote
this as V (). Now, consider another matching : (i) = (i) = i if i R and (ih ) = ih1
if h {2, 3, . . . , k} and (i1 ) = ik . Note that is the matching implicitly implied by the
P
cycle, and V ( ) = hR vhh + [vi1 ik + vi2 i1 + vi3 i2 + . . . + vik ik1 ]. Hence, length of cycle C
is V () V ( ).
Now, suppose is efficient. Then, V () V ( ). Hence, length of cycle C is nonnegative, and can be fairly priced. For the converse, suppose can be fairly priced. Then,
every cycle has non-negative length. Assume for contradiction that it is not efficient. Then,
for some , we have V ()V ( ) < 0. But every corresponds to a reassignment of objects,
and thus corresponds to a cycle. To see this, let C = {i M : 1 (i) 6= 1 (i)}. Without
loss of generality, assume that C = {i1 , . . . , ik }, and suppose that (ir ) = ir1 for all r
{2, . . . , k} and (i1 ) = ik . Then, the length of the cycle (i1 , . . . , ik , i1 ) is V () V ( ). Since
lengths of cycles are non-negative, this implies that V () < V ( ), which is a contradiction.
Let us revisit the example in Table 1. We can verify that if is efficient, then G has
no cycles of negative length. In this case, we can compute a price vector which fairly prices
by taking shortest paths from any fixed node. For example, fix node 1, and set p(1) = 0.
Then, p(2) = s(1, 2) = 3 and p(3) = s(1, 3) = 2.
10
Consider an agent coming to an interview. The agent has a private information, his ability,
which is called his type. Let us assume that type of the agent is a real number in a finite
set T = {t1 , t2 , . . . , tn }, where ti R for all i {1, . . . , n} and t1 < t2 < . . . < tn . The
interviewer does not know the type of the agent. The agent reports some type and given this
type, the interviewer assigns a number in [0, 1], called the allocation. The allocation reflects
the probability of getting the job or the fraction of the responsibility assigned to the agent.
The interviewer knows the set T but does not know what the actual type of the agent. This
33
leaves the room open for the interviewer to report any type to increase his utility. So, an
allocation rule is a mapping a : T [0, 1].
Given an allocation and his ability, the agent derives some value or cost from the job.
This is captured by the valuation (cost) function v : [0, 1] T R.
Along with the allocation, there is a payment done to the agent. This is again a function
of the reported type. So, a payment rule is a mapping p : T R. We assume that if an
agent reports type s to an allocation rule a and payment rule p when his true type is t, his
net utility is
v(a(s), t) + p(s).
Definition 8 An allocation rule a : T [0, 1] is implementable if there exists a payment
rule p : T R such that reporting true type is a dominant strategy, i.e.,
v(a(t), t) + p(t) v(a(s), t) + p(s)
s, t T.
The digraph Ga is shown in figure 27. It is easily seen that (0, 1, 0) is a negative length
cycle of this digraph. So, a is not implementable in this example.
0
0
0.5
1
0
0
2
0.5
1
2
1
Example 2
Example 1
11
We are given a directed graph G = (N, E, c), where the weight function c : E R++
(positive) reflects the capacity of every edge. We are also given two specific vertices of this
digraph: the source vertex, denoted by s, and the terminal vertex, denoted by t. Call such
a digraph a flow graph. So, whenever we say G = (N, E, c) is a flow graph, we imply that
G is a digraph with a source vertex s and terminal vertex t.
35
i+ (f ) =
f (i, j)
(j,i)E
i (f ) = i+ (f ) i (f ).
A flow f is a feasible flow for a flow graph G = (N, E, c) if
1. for every (i, j) E, f (i, j) c(i, j) and
2. for every i N \ {s, t}, i (f ) = 0.
So, feasibility requires that every flow should not exceed the capacity and excess flow at
a node must be zero.
Definition 9 The maximum flow problem is to find a feasible flow f of a flow graph
G = (N, E, c) such that for every feasible flow f of G, we have
t (f ) t (f ).
The value of a feasible flow f in flow graph G = (N, E, c) is given by (f ) = t (f ). So,
the maximum flow problem tries to find a feasible flow that maximizes the value of the flow.
Figure 28 shows a flow graph with a feasible flow. On every edge, capacity followed by
flow amount is written. It is easy to verify that this flow is feasible (but verify that this is
not a maximum flow).
The maximum flow problem has many applications. One original application was railways. Suppose there are two cities, say Delhi and Mumbai, connected by several possible rail
networks (i.e., routes which pass through various other cities). We want to determine what
is the maximum traffic that can go from Delhi to Mumbai. The capacity of traffic from a
city to another city is given (by the train services between these two cities). So, the solution
of the problem is the solution to the max flow problem.
11.1
We now analyze some properties of the maximum flow problem. The first property is immediate.
36
1/1
1/0
1/1
s
t
2/2
2/1
1/1
1/1
1/0
s
t
2/2
2/2
1/1
1/0
1/1
s
t
2/2
2/1
38
iS
f (i, j)
f (i, j)
(i,j)S +
(i,j)S
f (i, j)
(i,j)S
c(i, j)
(i,j)S
= (S),
where the inequality comes from feasibility of flow. Note that both the inequalities are
equalities for saturated flows. So (2) follows. For (3), note that if (S, N \ S) is saturated
for flow f , then (f ) = (S). For any feasible flow f , we know that (f ) (S) = (f ).
Hence, (3) follows.
Lemma 10 says that if there is a (s, t)-cut which is saturated for flow f , then f is a
maximum flow. However, if f is a maximum flow, then not every (s, t)-cut is saturated.
Figure 31 shows a maximum flow and an (s, t)-cut which is not saturated.
2
2/2
1/1
1/1
s
t
2/2
1/1
Figure 31: A maximum flow f does not imply every (s, t)-cut is saturated for f
11.2
We now proceed to identify some key properties which will help us identify a maximum flow.
The first is the construction of a residual digraph. Let f be a feasible flow in flow graph
G = (N, E, c). We define the residual digraph Gf for flow f as follows:
39
1/1
1/0
1/1
s
t
1
2/2
2/1
1
1
1/1
1/1
1
1/0
s
t
2/2
2/2
2
2
1
Theorem 10 Let f be a feasible flow of a flow graph G = (N, E, c) and Gf be the residual
digraph for flow f . The feasible flow f is a maximum flow for G if and only if there is no
path from s to t in Gf .
Proof : Suppose f is a maximum flow. Assume for contradiction that there is path P =
(s, v1 , v2 , . . . , vk , t) from s to t in Gf . Let E P be the set of edges in P corresponding to
+
original graph G, and let E P be the set of forward edges in P and E P be the set of reverse
edges in P (again, corresponding to original graph G). Define = min(i,j)E P cf (i, j) and let
+
41
So, f is a feasible flow. Let (vk , t) be the unique edge in P which is incoming to t. Note
that there is no outgoing edge of t which is part of P . If (vk , t) is a forward edge, then the
inflow to t is increased by from f to f . If (vk , t) is a reverse edge, then the outflow from t
is decreased by from f to f . In either case, the excess flow of t is increased from f to f
by . So, (f ) = (f ) + > (f ). Hence, f is not a maximum flow. This is a contradiction.
It is worth going to Figure 32, and understand the augmenting path a bit more. Here,
the augmenting path in the residual digraph is (s, 2, 1, t). Note that = 1. So, we push 1
unit of flow more on (s, 2), then push back 1 unit of flow on (1, 2), and finally push 1 unit of
flow more on (1, t).
Suppose there is no path from s to t in Gf . Let S be the set of all vertices i in Gf such
that there is a path from s to i. Now, (S, N \ S) defines an (s, t)-cut in G. Since there is no
path from s to t in Gf , there is no edge (i, j) E f such that i S and j (N \ S) in Gf .
This implies that in the original flow graph G,
1. for every edge (i, j) E such that i S and j (N \ S), we have f (i, j) = c(i, j), and
2. for every edge (j, i) E such that i S and j (N \ S), we have f (j, i) = 0.
This implies that the cut (S, N \ S) is a saturated cut for flow f in flow graph G. By Lemma
10, f is a maximum flow.
This theorem leads to one of the most well known results in graph theory. Denote by
F , the set of all feasible flows of a flow graph G = (N, E, c). Denote by S G , the set
{S N : (S, N \ S) is an (s, t)-cut of G}.
G
Theorem 11 For every flow graph G = (N, E, c) with a source vertex s and a terminal
vertex t
max (f ) = min (S).
f F G
SS G
11.3
Ford-Fulkerson Algorithm
The following algorithm, known as the Ford-Fulkerson algorithm, finds the maximum flow
of a flow graph if the capacities are rational.
42
We are given a flow graph G = (N, E, c) with a source vertex s and a terminal vertex t.
Assume that there is at least one path from s to t. Then, the algorithm goes as follows.
S0 Start with zero flow, i.e. f (i, j) = 0 for all (i, j) E.
S1 Construct the residual digraph Gf .
S2 Check if the residual digraph Gf has a path from s to t.
S2.1 If not, stop - f is the maximum flow.
S2.2 If yes, increase flow along an augmenting path (i.e., a path in Gf from s to t) by
the minimum residual capacity on that path as shown in Theorem 10 (feasibility
is maintained). Iterate from Step S1.
If the algorithm terminates, then from Theorem 10 it must find a maximum flow. If
the flows are integral, then the algorithm must terminate since capacities are finite integers
and in every iteration the flow increases by at least one. Note that if all capacities are
integral, then the algorithm outputs an integral flow. So, if all capacities are integral, then
the maximum flow is also an integral flow. As an exercise, find the maximum flow of the
digraph in Figure 34. You can verify that the maximum flow amount is 7.
1
5
4
3
t
3
5
2
2/2
5/2
4/2
3/0
2/0
t
3/2
5/2
2/2
2
2
s
3
4
2
2/2
5/5
4/2
3/3
2/0
t
3/2
5/5
2
2/2
is an integer for all (i, j) E. Then, in every iteration, the flow is augmented by at least
1
. Since the flow value is bounded (by the minimum cut capacity), the algorithm must
K
terminate finitely.
However, the algorithm may not terminate in general for irrational capacities. You are
encouraged to think of an example with irrational capacities.
12
Disjoint Paths
We now study another graph problem, and a max-min relation on this. In this problem, we
are given a digraph and two vertices in it, and we are asked to find the maximum number
of disjoint paths in such a digraph. This has applications in communication networks.
The premise of this problem is a directed graph G = (N, E) (not weighted) and two
special vertices s (source - with no incoming edges) and t (terminal - with no outgoing
edges). We are interested in finding the number of edge-disjoint paths from s to t, where
two paths are edge disjoint if they do not share an edge. Two disjoint paths (in dark black
and blue) for a digraph are shown in Figure 38.
3
45
Proof : Suppose there are at least k disjoint paths from s to t. Then deleting (k 1) edges
from G will not delete one edge from at least one of the paths from s to t. Hence, there will
remain at least one path from s to t.
Suppose there is a path from s to t after deleting any (k 1) edges from G. We convert
G into a flow graph, where the capacity function is defined as follows: c(i, j) = 1 for all
(i, j) E. Since there is at least one path from s to t after deleting any (k 1) edges from
G, the capacity of any (s, t)-cut in G must be at least k. Hence, the maximum flow in G
must be at least k. Now, note that any feasible integral flow in G is either (a) a set of paths
from s to t or (b) a cycle (not involving s or t). Also, an integral maximum flow exists.
Consider such an integral maximum flow. If a maximum flow involves a cycle, we can set
the flow in this cycle to zero without loss of generality, and still get an integral maximum
flow. Hence, without loss of generality, a maximum flow consists of a set of paths from s to
t. Since the capacity of every edge is just 1, one edge can carry flow of only one path from
s to t. Hence, each unit of flow from s to t corresponds to a unique path from s to t. So,
there are at least k disjoint paths from s to t.
An immediate corollary to this result is the following.
Corollary 1 Suppose G = (N, E) is a digraph with source vertex s and terminal vertex
t. The number of disjoint paths from s to t in G equals the minimum number of edges that
need to be removed from G such that there are no paths from s to t.
Proof : Suppose there are k disjoint paths from s to t. Let the minimum number of edges
that need to be removed from G such that there are no paths from s to t be . This means
by deleting any 1 edges from G, there is still a path from s to t. By Theorem 13, k .
Suppose k > . Then, again by Theorem 13, by removing any k 1 edges there is still a
path from s to t. This contradicts the fact that by removing edges there is no path from s
to t.
A small comment about disjoint paths. Suppose we have k disjoint paths. Let the first
edges of these paths be: (s, i1 ), (s, i2 ), . . . , (s, ik ). This obviously means there are at least
k edges from s to the rest of the graph. However, it does not mean that by deleting
(s, i1 ), (s, i2 ), . . . , (s, ik ), there is no path from s to t. The example in Figure 39 illustrates
that. There are two disjoint paths from s to t in the graph in Figure 39. Take for example
the pair of disjoint paths (s, 1, 2, t) and (s, 3, 4, t) (there are other pairs of disjoint paths). If
we remove two edges (s, 1) and (s, 3), there are still paths from s to t.
46
47