Lemma of Gessel Viennot 1 Overview 2 Definitions

Jan-Apr 2014
Advanced Graph Algorithms
Lemma of Gessel Viennot
Speaker: Diptapriyo Majumdar
1
Date: April 22, 2014
Overview
In the last few lectures, we had learnt different algorithms using matrix multiplication. For example
strassen’s algorithm for matrix multiplication, finding max cut problem of a weighted graph, finding
witness for boolean matrix multiplication, min plus product of two matrices etc etc. Today, we will
learn Gessel Viennot Lemma. It is one that establishes a connection between lattice paths and
determinants. It was first proved by Lindstrom, but its combinatorial significance was first seen by
Gessel and Viennot. They establishes a connection between the path systems and determinant.
2
Definitions
Let G = (V, E) be a directed acyclic graph, a weight function w : E → R and A = (A1 , A2 , . . . , An ),
B = (B1 , B2 , . . . , Bn ) be two sets of vertices which are not necessarily disjoint.
Definition 1. A path system P is given by σ ∈ Sn and n paths P1 : A1 → Bσ(1) , P2 : A2 →
Bσ(2) , . . . , Pn : An → Bσ(n) . Weight of a path system P is denoted as
n
Y
w(P) =
w(Pi )
i=1
and sign(P) = sign(σ).
Weight of a path P is given by the product of the edges in the path.
w(P ) =
Y
w(e)
e∈P
When the path P is from vertex v to vertex v, it does not contain any edge since the graph is directed
acyclic graph, we consider w(P ) = 1.
Definition 2. A path system P is said to be vertex disjoint if for any two paths Pi , Pj ∈ P, there
is no vertex in common.
Definition 3. Path Matrix M = [mi,j ]ni,j=1 from A to B is defined as follows.
mi,j =
X
P :Ai →Bj
1
w(P )
3
Interpretation of a square matrix as a path matrix of a bipartite
graph
Let M be a square matrix. Construct a directed bipartite graph G = (A, B, E) with A =
(A1 , . . . , An ) that corresponds to the rows of M and B = (B1 , B2 , . . . , Bn ) that corresponds to
columns of M . E = {(Ai , Bj )|i, j ∈ [n]} and w(Ai , Bj ) = mi,j .
In this graph, consider Ai and Bj , there is only one path from that goes from Ai to Bj which is
just the edge (Ai , Bj ) and w(P ) = w(Ai , Bj ) = mi,j .
Now, lets consider the permutation description of determinant.
det(M ) =
X
sign(σ)
n
Y
mi,σ(i)
i=1
σ∈Sn
Define ψ : AllP athSystems → Sn as ψ(P) = σ where P is defined as σ and n paths.
Lemma 4. ψ is a bijection.
Proof. Consider any path system P from A to B. For that P there is unique σ ∈ Sn .
Let ψ(P) = σ1 and ψ(Q) = σ2 and σ1 = σ2 , then ∀i ∈ [n] : σ1 (i) = σ2 (i). Then, let P is given by
σ1 and n unique paths. Q also gives σ2 and n unique paths. Now, σ1 = σ2 . Now, fix any σ ∈ Sn .
Then for every i ∈ [n], there is only one path from Ai to Bσ(i) in G. Therefore, P = Q since
σ1 = σ2 . Therefore, ψ is injective.
Take any σ ∈ Sn . By the construction of the graph, clearly, for this σ, there is a path system Pσ
with n paths P1 : A1 → Bσ(1) , P2 : A2 → Bσ(2) , . . . , Pn : An → Bσ(n) where weights the paths are
w(Pk ) = w(Ak , Bσ(k) ) = mk,σ(k) . Therefore, ψ is surjective.
Therefore, ψ is a bijection.
Similarly consider any σ ∈ Sn , then there is a unique path system P from A to B. w(P) =
n
n
Q
Q
w(Ai , Bσ(i) ) =
mi,j
i=1
i=1
det(M ) =
P
σ∈Sn
sign(σ)
n
Q
i=1
mi,σ(i) =
P
sign(P)
P
n
Q
i=1
mi,j =
P
sign(P)w(P).
P
This summation is over all path systems. In this way, we interpret a given square matrix as path
matrix of a directed bipartite graph.
4
Gessel Viennot Lemma
Gessel Viennot Lemma generalizes this interpretation from bipartite graph to general directed
acyclic graph. Statement of the lemma is as follows.
2
Theorem 5. Let G = (V, E) be a directed acyclic graph, a weight function w : E → R and
A = (A1 , A2 , . . . , An ), B = (B1 , B2 , . . . , Bn ) be two sets of vertices which are not necessarily disjoint.
Let M be the path matrix from (A) to (B) and let V D be the set of all vertex disjoint path systems
from A to B. Then
X
det(M ) =
sign(P)w(P)
P∈V D
Proof. Lets consider the permutation description of determinant.
X
det(M ) =
sign(σ)
sign(σ)
n
Y
mi,σ(i)
i=1
σ∈Sn
Fix arbitrary σ ∈ Sn . Consider sign(σ)
n
Y
Qn
i=1 mi,σ(i) .
mi,σ(i) = sign(σ)[
X
w(P1 )] . . . [
P1 :A1 →Bσ(1)
i=1
X
w(Pn )]
Pn :An →Bσ(n)
Now, for a given σ there are collection of path systems from A to B. Define
Pσ = {P|P is a path system from A to B given by σ}
Now, we have
sign(σ)
n
Y
mi,σ(i) = sign(σ)[
X
w(P1 )] . . . [
P1 :A1 →Bσ(1)
i=1
=
X
X
w(Pn )]
Pn :An →Bσ(n)
sign(P)w(P)
P∈Pσ
We know that
S
Pσ = AllP athSystems.
σ∈Sn
Therefore, we get
X
sign(σ)
n
Y
mi,σ(i) =
=
sign(R)w(R)
σ∈Sn R∈Pσ
i=1
σ∈Sn
X X
X
sign(P)w(P)
P∈AllP athSystems
we get summation over all path systems P from A to B. Therefore, we have
X
det(M ) =
sign(P)w(P )
P
Now, we have to prove that
P
P
P
sign(P)w(P ) =
P∈V D
will prove this theorem.
3
sign(P)w(P ). Proving the following lemma
Lemma 6.
P
sign(P)w(P ) =
P
P
sign(P)w(P )
P∈V D
Proof. Let N D be the set of path systems that are not vertex disjoint path systems from A to B.
We break the left hand side as follows since the set of all path systems is partitioned into V D and
N D.
X
P
X
sign(P)w(P ) =
sign(P)w(P ) +
P∈V D
X
sign(P)w(P )
P∈N D
Pick any R ∈ N D. R = (R1 , . . . , Rn ). Among the crossing paths, we define the following things:
i0 = smallest index such that Ri0 crosses with some Rj with j > i0 .
X = first vertex at which Ri0 is intersected by some other path in R.
j0 = smallest index of all the paths in R that intersect Ri0 at X (or equivalently smallest index of
all paths such that X ∈ Ri0 ∩ Rj0 )
Now, we define involution on N D as follows.
Define φ : N D → N D by φ(R) = T = (T1 , . . . , Tn ) where
Tk = Rk when k 6= i0 , j0
Ti0 : From Ai0 , traverse the edges of Ri0 till it reaches X. After that it traverses the edges of Rj0
from X to reach Bσ(j0 ) .
Tj0 : From Aj0 , traverse the edges of Rj0 till it reaches X. After that it traverses the edges of Ri0
from X to reach Bσ(i0 ) .
Bσ(j0 )
Ri0
X
Ai 0
Rj0
Bσ(i0 )
Aj 0
edges of Ri0
edges of Ri0
Bσ(j0 )
Ri0 0
Ai 0
Bσ(i0 )
X
Aj 0
Rj0 0
edges of Rj0
edges of Rj0
Therefore, for the path system R0 , we get σ 0 ∈ Sn where σ 0 = σ · (i0 j0 ). Therefore, sign(σ 0 ) =
sign(σ)sign(i0 j0 ) = −sign(σ). Therefore, −sign(R) = sign(T ). Also both T and R consists of
4
same set of edges. Therefore,
w(T ) =
n
Y
w(Ti ) = [
i=1
Y
w(Tk )].w(Ti0 ).w(Tj0 ) = [
Y
w(Rk )].w(Ti0 ).w(Tj0 )
k∈[n]\{i0 ,j0 }
k∈[n]\{i0 ,j0 }
Now, set of edges that are there in Ti0 , Tj0 are the same set of edges that are there in Ri0 , Rj0 .
Therefore
Y
Y
w(e) =
w(e) = w(Ri0 )w(Rj0 )
w(Ti0 )w(Tj0 ) =
e∈Ti0 ∪Tj0
e∈Ri0 ∪Rj0
Therefore, w(R) = w(T ).
Now, if we apply φ again, then let φ(T ) = Z.
Zk = Tk = Rk when k 6= i0 , j0
Zi0 : From Ai0 , traverse the edges of Ti0 till it reaches X. After that it traverses the edges of Tj0
from X to reach Bσ0 (j0 ) = Bσ(i0 ) . This yields path which is same as Ri0 .
Zj0 : From Aj0 , traverse the edges of Tj0 till it reaches X. After that it traverses the edges of Ti0
from X to reach Bσ0 (i0 ) = Bσ(j0 ) . This yields path Rj0 .
Therefore, Z = R. Therefore, φ(φ(R)) = R. Since φ = φ−1 , therefore, φ is a bijection. Therefore,
we have found an one to one correspondance to obtain pairs of path systems (R, φ(R)) in N D where
for every pairs
P of path systems with w(R) = w(φ(R)) and sign(R) = sign(φ(R)). Therefore, we
get that
sign(P)w(P ) = 0.
P∈N D P
P
It implies that
sign(P)w(P ) =
sign(P)w(P ).
P
P∈V D
Proving the lemma proves that det(M ) =
P
sign(P)w(P ) which proves the theorem.
P∈V D
4.1
Example of a graph and path matrix
We give an example of a directed acyclic graph and its corresponding path matrix. Let G be the
graph as drawn in figure. Notice that A and B are not disjoint. In fact, in this path matrix, there
are path systems which are not vertex disjoint(common vertex can be present even at endpoints
also).
1
A2 = B 1
A1
2
2
B2
5
The path systems are as follows.
P1 = [({A1 → B1 }, {A2 → B2 }), (1)(2)]
P2 = [({A1 → B1 → B2 }, {A2 → B1 }), (12)]
P3 = [({A1 → B2 }, {A2 → B1 }), (12)]
Only P3 is vertex disjoint path system.
Now the elements of the path matrix M are as follows:
m11 = w(A1 → B1 ) = 2
m12 = w(A1 → B1 → B2 ) + w(A1 → B2 ) = 1.2 + 2 = 4
m21 = w(A2 → B1 ) = 1
m22 = w(A2 → B2 ) = 2
Therefore, det(M ) = 2 − 4 = −2 and
X
sign(P)
P∈V D
n
Y
w(Pi ) = sign(P3 ).w(P3 ) = (−1).w({A1 → B2 }).w(({A2 → B1 }) = (−1).2.1 = −2
i=1
.
Therefore, we can see that the Gessel Viennot Lemma holds.
5
Applications of Gessel Viennot Lemma to Matrix Properties
It has applications to Matrix Theorems as well as some combinatorial applications. Consider these
applications in matrix theorems.
5.1
Application 1:
For any square matrix M , det(M ) = det(M T ).
Proof. For M , we consstructed a directed bipartite graph G = (A, B, E) with bipartitions A, B and
E = {(Ai , Bj )|Ai ∈ A, Bj ∈ B}
Now, mTij = mji . Now, we construct the bipartite graph H = (C, D, F ) where C = A, D = B and
F = {(Di , Cj )|Di ∈ D, Cj ∈ C}
Now, since sign(σ) = sign(σ −1 ), therefore we get
det(M T ) =
X
sign(P)w(P) =
P
X
σ∈Sn
6
sign(σ)
n
Y
i=1
mTi,σ(i)
=
X
sign(σ)
σ∈Sn
=
X
n
Y
mk,σ−1 (k)
k=1
n
Y
sign(σ −1 )
σ∈Sn
mk,σ−1 (k)
k=1
= det(M )
5.2
Application 2:
For any two square matrices of same size M1 , M2 , det(M1 .M2 ) = det(M1 )det(M2 ).
Proof. Construct these set of vertices A = (A1 , . . . , An ), B = (B1 , . . . , Bn ), C = (C1 , . . . , Cn ). We
construct the directed graph with vertex A, B, C where edges are directed from A to B and also
from B to C with w(Ai , Bj ) = m1 [i, j] and w(Bj , Ck ) = m2 [j, k].
A corresponds to the rows of M1 . B corresponds to the columns of M1 as well as to the rows of
M2 . C corresponds to the columns of M2 .
Let M = M1 .M2 . Then, m[i, j] =
n
P
m1 [i, k].m2 [k, j]. Now, we consider an arbitrary vertexd
k=1
disjoint path systems P from A to C. P must come through vertices of B. Since P is vertex
disjoint, therefore any path system which is a subpath system of P is also vertex disjoint. Now, we
see that any vertex disjoint path system P from A to C is divided into two parts Q and R where
Q is a vertex disjoint path system from A to B and R is a vertex disjoint path system from B to
C. Let W be the set of all vertex disjoint path systems from A to B and Z be the set of all vertex
disjoint path systems from B to C. Now consider
det(M1 ).det(M2 ) =
X
sign(Q)w(Q)
Q∈W
=
X
X
sign(R)w(R)
R∈Z
sign(R)sign(Q)w(R)w(Q)
P∈W ×Z
Now W × Z is the set of all ordered pair of vertex disjoint path systems where the for every pair
(Q, R) where Q is a vertex disjoint path system from A to B and R is a vertex disjoint path system
from B to C.
Now, Q ' (σQ , Q1 , Q2 , . . . , Qn ) where ∀i ∈ [n] : Qi : Ai → BσR (i) .
R ' (σR , R1 , R2 , . . . , Rn ) where ∀i ∈ [n] : Ri : Bi → CσR (i) .
Now, consider Pi : Ai → BσQ (i) → CσR (σQ (i)) . Composition of two permutations is also a permutation. Let σQ ◦ σR = σ. So, composition of Q and R gives a path system P.
7
We have to show that W × Z exhausts the set of all vertex disjoint path systems from A to C.
Take any vertex disjoint path system P given by σ ∈ Sn from A to C. Since it is vertex disjoint
and every path from A to C comes through B and P exhausts all vertices of B (otherwise P would
not be vertex disjoint). Therefore, P is decomposed into Q (vertex disjoint path system from A
to B) and R (vertex disjoint path system from B to C). It easily follows that w(P) = w(Q)w(R).
Also, since sign(σ) = sign(σQ ◦ σR ) = sign(σQ )sign(σR ), therefore, sign(P) = sign(Q).sign(R).
Therefore, we have the followings.
det(M1 ).det(M2 ) =
X
sign(R)sign(Q)w(R)w(Q) =
P∈W ×Z
5.3
X
sign(P)w(P) = det(M1 .M2 )
P
Application 3
This application is a generalization of application 2. It is called Cauchy Binet Formula.
Theorem 7. Let M1 be an n × r matrix and M2 be an r × n matrix with n ≤ r. Then we have the
following
X
det(M1 .M2 ) =
det(M1 [X]).det(M2 [X])
X⊆[r],|X|=n
where M1 [X] is the matrix restricted to the columns indexed by X and M2 [X] is the matrix restricted
to the rows indexed by X.
Proof. Construct the directed graph G = (A∪B∪C, E) where A = (A1 , . . . , An ), B = (B1 , . . . , Br ), C =
(C1 , . . . , Cn ). E = {(Ai , Bj )|i ∈ [n], j ∈ [r]} ∪ {(Bj , Ck )|j ∈ [r], k ∈ [n]}. Also, we assign weights to
the edges as w(Ai , Bj ) = m1 [i, j] and w(Bj , Ck ) = m2 [k, j].
Let M = M1 .M2 . m[i, j] =
r
P
m1 [i, k]m2 [k, j].
k=1
Fix any arbitrary X ⊆ [r]. Let PAX be the set of all vertex disjoint path systems from A to
B[X ](B[X] be the subset of B restricted to the indices denoted by X) and PXB be the set of all
vertex disjoint path systems from B[X ] to C. Then, consider det(M1 [X]).det(M2 [X]).
X
X
det(M1 [X]).det(M2 [X]) =
sign(Q)w(Q).
sign(R)w(R)
Q∈PAX
R∈PXB
Now, similar to the Lemma 6, we know that PAX × PXB exhausts the set of all vertex disjoint path
systems from A to C that passes through this B[X]. Therefore we have that
X
X
X
sign(Q)w(Q).
sign(R)w(R) =
sign(P)w(P)
Q∈PAX
R∈PXB
P∈PAX ×PXB
8
P
Now, in order to get
det(M1 [X]).det(M2 [X]), we have to sum the expression
X⊆[r],|X|=n
[
X
sign(P)w(P)]
P∈PAX ×PXB
over all X ⊆ [r].
This summation will also give the summation over the set of all vertex disjoint path systems
from A to C.
Therefore we have,
X
X
det(M1 [X]).det(M2 [X]) =
[
X
sign(P)w(P)]
X⊆[r],|X|=n P∈PAX ×PXB
X⊆[r],|X|=n
=
X
sign(P)w(P) = det(M1 .M2 )
P
6
Combinatorial Applications of Gessel Viennot Lemma
Gessel Viennot Lemma also has some interesting combinatorial applications such as Binomial
Determinants in terms of Lattice Paths, Rhombic Tilings are all available in [1].
References
[1] Martin Aigner: A Course in Enumeration, Springer.
[2] Justin Chan: The Gessel Viennot Lemma and its Applications to Combinatorics, Math 821,
December 14, 2010.
[3] Martin Aigner, Gunter M. Zeigler: Proofs From THE BOOK, Springer, Fourth Edition
9