R. Bar-Yehuda           ©                            www.cs.technion.ac.il/~cs234141
1
Graph theory      תורת הגרפים 2.3 CAYLEY’S THEOREM–      משפט קייליGraph theory      תורת הגרפים 2.3 CAYLEY’S THEOREM–      משפט קיילי
מבוסס על הספר:
 S. Even, "Graph Algorithms",
Computer Science Press, 1979
שקפיםספר וחומר רלוונטי נוסף באתרהקורס:שקפיםספר וחומר רלוונטי נוסף באתרהקורס:
Slides, book and other related material at:
R. Bar-Yehuda           ©                            www.cs.technion.ac.il/~cs234141
2
2.3 CAYLEY’S THEOREM משפט קיילי2.3 CAYLEY’S THEOREM משפט קיילי
Theorem 2.4: The number of spanning treesfor n distinct vertices is nn-2.
Proof: )Prüfer( Assume V = {1, 2, ..., n}. Letus display a one-to-one correspondencebetween the set of the spanning trees andthe nn-2 words of length n – 2 over thealphabet {1, 2, ..., n}.
The algorithm for finding the word whichcorresponds to a given tree is as follows:
R. Bar-Yehuda           ©                            www.cs.technion.ac.il/~cs234141
3
Theorem 2.4The number of spanningtrees for distinct vertices is nn-2.Theorem 2.4The number of spanningtrees for distinct vertices is nn-2.
V = {1, 2, ..., n} קלט: עץ עם צמתים:
{1, 2, ..., n}  מעל א"ב n-2 פלט: מילה באורך
For i=1 to n-2 do
     Among all leaves of the current tree
         let j be the least one.
     Eliminate j and its incident edge e from the tree.
     The i-th letter of the word
     is the other endpoint of e.
R. Bar-Yehuda           ©                            www.cs.technion.ac.il/~cs234141
4
a[i] ja[i] j
 
j
עלה מינימלי
R. Bar-Yehuda           ©                            www.cs.technion.ac.il/~cs234141
5
1;  j=3; min=1   a[1] 31;  j=3; min=1   a[1] 3
3
עלה מינימלי
1
2
4
5
R. Bar-Yehuda           ©                            www.cs.technion.ac.il/~cs234141
6
2; j=2; min=3;    a[2] 22; j=2; min=3;    a[2] 2
3
עלה מינימלי
1
2
4
5
R. Bar-Yehuda           ©                            www.cs.technion.ac.il/~cs234141
7
3; j=2; min=4;      a[3] 23; j=2; min=4;      a[3] 2
3
עלה מינימלי
1
2
4
5
R. Bar-Yehuda           ©                            www.cs.technion.ac.il/~cs234141
8
n-2   w="322" בסיום:n-2   w="322" בסיום:
3
1
2
4
5
R. Bar-Yehuda           ©                            www.cs.technion.ac.il/~cs234141
9
Theorem 2.4: The number of spanningtrees for distinct vertices is nn-2.Theorem 2.4: The number of spanningtrees for distinct vertices is nn-2.
{1, 2, ..., n מעל א"ב n-2 קלט:  מילה באורך
V = {1, 2, ..., nפלט: עץ עם צמתים:
For i=1 to n-2 do
      Let be the least vertex for which d(j) = 1.
           Construct an edge j – ai,
           d(j)  0 and d(ai d(ai) – l.
Construct an edge between
           the two vertices whose degree is 1