Graphs II: Great Theoretical Ideas in Computer Science
Graphs II: Great Theoretical Ideas in Computer Science
15-251
Great Theoretical Ideas in Computer Science
Graphs II
Lecture 9, February 12, 2013
Cayleys Formula
Recap
Spanning Trees
A spanning tree of a graph G is a tree that touches every node of G and uses only edges from G
Counting Spanning Trees How can we count the number of spanning trees in a graph? Brute force: try all e subsets of n-1 edges. (n-1 )
13-2-13
Counting Spanning Trees Efficiently Form the Laplacian of the graph. This is an n!n matrix L, where: Degree(i) if i=j Li j = -1 0
2 1 4 5 3
Counting Spanning Trees Efficiently Matrix-Tree Theorem: The number of spanning trees of a graph is the determinant of the Laplacian with one row and column removed. Proof: Beyond the scope of this course (See the book Graph Algorithms by Shimon Evan, pp 34-40.) Computing the determinant is O(n^3). This gives an O(n^3) algorithm for counting the number of spanning trees of a graph.
if (i,j)
otherwise 3 -1 0 -1 -1 -1 2 -1 0 0 0 -1 2 -1 0 -1 0 -1 3 -1 -1 0 0 -1 2
L=
2 1 4 5 3
L=
3 -1 0 -1 -1
-1 2 -1 0 0
0 -1 2 -1 0
-1 0 -1 3 -1
-1 0 0 -1 2
If G is the complete graph on n nodes what happens? We have this (n-1)!(n-1) det: n-1 -1 -1 n-1 . . . . . . -1 -1 -1 . . .
Subtract 1st column from every other column
2 -1 0 0 -1 2 -1 0 0 -1 3 -1 0 0 -1 2
-1 n-1
n-1 -n -n -n -1 n 0 0 . . . . . . . . . -1 0 0 n
= 11
(do in Mathematica)
Add every one of the rows to the first
1 -1 . . . -1
0 0 n 0 . . . . . . 0 n
= nn-2
Cayleys Formula!
13-2-13
Kruskals Algorithm
13-2-13
Bipartite Graph
A graph is bipartite if the nodes can be partitioned into two sets V1 and V2 such that all edges go only between V1 and V2 (no edges go from V1 to V1 or from V2 to V2)
13-2-13
Dancing Partners
A group of 100 boys and girls attend a dance. Every boy knows 5 girls, and every girl knows 5 boys. Can they be matched into dance partners so that each pair knows each other?
Dancing Partners
Perfect Matchings
A matching is a set of edges, no two of which share a vertex. The matching is perfect if it includes every vertex. Regular Bipartite Matching Theorem: If every node in a bipartite graph has the same degree d # 1, then the graph has a perfect matching. Note: if degrees are the same then |A| = |B|, where A is the set of nodes on the left and B is the set of nodes on the right
A Matter of Degree
Claim: If degrees are the same then |A| = |B| Proof: If there are m boys, there are md edges If there are n girls, there are nd edges
13-2-13
B k
n-k<
n-k
13-2-13
Example
Suppose that a standard deck of cards is dealt into 13 piles of 4 cards each Then it is possible to select a card from each pile so that the 13 chosen cards contain exactly one card of each rank
Proof: Form a bipartite graph as follows: Start with 52 cards on the left and the same 52 cards on the right, connected by 52 edges. Now group the cards on the left into 13 sets according to the given piles. Group the cards on the right into 13 groups according to rank. Let the edges be inherited from the original ones. This bipartite graph is matchable -- k groups on the left have to connect to 4k cards on the right, thus they connect to at least k groups on the right. And thus has a perfect matching.
The proof of Halls Theorem is slightly more complicated (but not much) than our proof of the Marriage Theorem. You can find the proof on Wikipedia, or on pages 218 and 219 of Mathematical Thinking by DAngelo and West.
Then we can choose an element xi from each Si so that {x1, x2, } are all distinct
Minimum Spanning Tree - Definition Counting spanning trees - Matrix-Tree Theorem Kruskals Algorithm - Definition - Proof of Correctness Traveling Salesman Problem Heres What You Need to Know - Definition - Using MST to get an approximate solution The Marriage Theorem