Using the Adjacency Matrix to Count Walks Example using

MC302 GRAPH THEORY
Tuesday, 9/17/13
Today:
Reading:
Exercise:
More on Adjacency and Incidence Matrices
Still [CH] 1.7
[CH] 1.7.3, 1.7.5 (use Mathematica for 1.7.5)
Tuesday, 9/17/13, Slide #1
Using the Adjacency Matrix to
Count Walks
If A is the adjacency matrix of a graph G,
we can think of entry (, )as giving the
number of walks of length 1 from to .
Powers of the adjacent matrix also give
us information:
Theorem: For ≥0, entry (, ) of the
matrix product gives the number of -
walks of length exactly .
We’ll prove this, but first, an example and
some corollaries.
Tuesday, 9/17/13, Slide #2
Example using Mathematica
i0 1 1 0 0y
A=
1
1
0
k0
0
1
0
0
1
0
1
0
0
1
0
1
0
0
1
0{
M a r
t x
i o
F m
r @ .
A A
D
i2 1 1 1 0y
A2 =
[email protected]
A3
=
1
1
1
k0
2
1
1
0
1
3
0
1
1
0
2
0
0
1
0
1{
i2 3 4 1 1 y
3 2 4 1 1
[email protected] 4 4 2 4 0
1 1 4 0 2
k1 1 0 2 0 {
What graph does represent?
What do the entries of 2
and 3 represent?
Notice that the diagonal
entries of 2 are the
vertex degrees – why?
What does 2 + 3
represent?
What can we conclude
from the fact that 2 + 3
has no zero entries?
Also see
MatrixProduct.130917.nb
Tuesday, 9/17/13, Slide #3
Corollaries
Cor. 1: Entry (, ) of the matrix sum,
0 + 1 + 2 + …+ gives the number of - walks of length
less than or equal to .
Cor. 2: A graph G with vertices is
connected if and only if the matrix sum,
0 + 1 + 2 + …+ has no nonzero entries.
This is not the most efficient algorithm to check
if G is connected.
Tuesday, 9/17/13, Slide #4
Review of Proof by Induction
Weak induction: For theorems Strong induction: Similar to weak
induction, but inductive assumption
of form
is different.
“() is true for all ≥ .”
Base case: Prove () is true
when = 1, i.e., prove (1) is
true.
Inductive case: Prove for
(arbitrary) ≥ 1, if () is
true, then ( + 1) is true.
() called the inductive
assumption;
( + 1) called inductive
conclusion.
Example: For all ≥ 1,
1 + 2 + …+ = ( + 1)/2.
Base case: Prove () is true
when = 1, i.e., prove (1) is
true.
Inductive case: Prove for
≥ 1, if (1), (2), … , ()are all
true, then ( + 1) is true. So
instead of assuming () is true,
we assume () is true for
1 ≤ ≤ .
Example: If a Hershey bar has
squares, then it requires
exactly − 1 breaks along lines
to break it into individual
squares.
Tuesday, 9/17/13, Slide #5
Proof of Walk-counting Theorem
Theorem. For ≥0, entry (, )of the matrix
product gives the number of - walks of
length exactly .
Proof is by induction on = the power of A.
Here n = # of vertices is fixed. We do induction
on ≥ 0, and base case is = 0.
Base Case:
0 = identity matrix, where = |( )|.
Inductive Case:
Assume: Theorem is true for some ≥0.
Prove: Theorem is true for + 1.
Tuesday, 9/17/13, Slide #6
Exercises
Suppose
has two components:
! = "»#, with no edges between " and #.
Write the vertex set of G as
$(!) = {&, … , &', &' + , … , &},where
$(") = {&, … , &'} and $(#) = {&' + , … , &}
With vertices in this order, what can you
say about the entries in the adjacency
matrix of ?
What about powers of ?
Tuesday, 9/17/13, Slide #7