Comp 163 Week 11 notes

Week of April 4


Review basic graph terminology

Handshaking Lemma


What goes wrong if you have a group of 7 people, and each tries to shake hands with exactly 5 others?

Degree sequence

Zork graph (

Some named graphs: Kn, Km,n (bipartite graph), Cn, Pn (just a path)

More graph terminology on page 242

Dr Sarada Herke, Univ of Queensland, AU, graph-theory Youtube:

Trees: A tree is a connected graph with no cycles.

Though most of the rest of computer science uses the word "tree" in the sense of something like the following binary search tree:

          /    \
         /      \
       4          9
     /   \      /  \
    2     5    8   37

It has an ordering based on levels. Graph trees have levels too, but only relative to a designated root node: the level is the distance to the root. And the graph-theory perspective completely loses the left-to-right ordering of all the nodes above.

        5       8
        |       |

4.2 Investigate! Spanning trees

Levin p 248: Prop 4.2.1: A graph is a tree if and only iff all paths are unique

Proposition 4.2.3: If a tree has at least two vertices, it has at least two vertices of degree 1.

Proof: induction on the length of the longest possible path.

Proposition 4.2.4: In a tree, e = v-1. (Remember that trees are connected.)

Rooted trees

A tree is rooted if one vertex is picked out, called the root. This gives us a reference point by which to reach every other vertex. The depth of a vertex is the distance (number of edges) along the path from that node to the root, or vice-versa.

parent/child relationships

Drawing rooted trees by level: Do this for example 4.2.5, with f as root, and also with e.

Depth-first search vs breadth-first search

Spanning Trees

Very important in computer networks!


Zork map (graph):

Another proof that, in a tree, e = v-1
Lemma: every tree with >= 2 vertices has at least one spike vertex: a vertex with degree 1 (Levin Prop 4.2.3 says there are at least two)
Lemma: if we remove an isolated vertex and its connecting edge from a tree, the remaining graph is still a tree
Now just remove the spike vertices and their attaching edges, one by one, until there is just one vertex left.

Spanning-tree algorithm

Algorithm 1: find a cycle, and remove one edge. Repeat until there are no more cycles.

Algorithm 2 [Radia Perlman]: Assume each vertex has a unique ID, and vertices can send messages along edges to neighbors.

Each vertex begins by declaring itself "root", and sends a message to each neighbor listing its own ID, the ID of the vertex it thinks is root, and the path length to the root.

Every time a vertex sees a message with a root with a lower ID, it switches.

Every time a vertex sees a message with the same root, but indicating a shorter path to root, it switches

Every time a vertex sees a message with the same root and same distance, but using a neighbor with a lower ID, it switches

Eventually, the root vertex is the one with the lowest ID.

The final step is to retain only those edges that are on some vertex's path to the root.


Homework 9

Planar graphs

Concept of faces in a graph

Euler's Formula for Planar Graphs, p 259 (also works for polyhedra, which are, as graphs, planar; see p 262)

Theorem 4.3.1: K5 is not planar.

Theorem 4.3.2: K3,3 is not planar.

Planar graphs can be drawn on the surface of a sphere, and vice-versa.