Skip to content

Graph theory basics and the handshake lemma

5 min read

Short answer

A graph is a set of vertices joined by edges. The degree of a vertex is the number of edges at it. Handshake lemma: ∑vdeg⁡(v)=2E\sum_v\deg(v)=2E, since every edge adds 11 to the degrees of two vertices. So the number of odd-degree vertices is always even.

Vocabulary compared with Counting factsVocabularyPath: edges joined endto endCycle: a closed pathConnected: a pathbetween any twoverticesCounting factsΣ deg(v) = 2EComplete graph Kₙ: n(n− 1)/2 edgesA tree on n verticeshas n − 1 edges
Many graph problems reduce to counting edges and degrees.

Trees

A tree is a connected graph with no cycles. A connected graph on nn vertices is a tree exactly when it has n−1n-1 edges. Trees model hierarchies, family lines and file systems.

Eulerian paths

A connected graph has a path using every edge once exactly when at most two vertices have odd degree. This is Euler's answer to the Königsberg bridges problem.

Worked example

Can a graph have 55 vertices with degrees 3,3,2,2,23,3,2,2,2? If so, how many edges?

The degree sum is 3+3+2+2+2=123+3+2+2+2=12, which is even, so it is possible. Then E=12/2=6E=12/2=6 edges. Degrees such as 3,3,3,2,23,3,3,2,2 sum to 1313, which is odd, so they cannot occur.

Try it yourself

How many edges does the complete graph K6K_6 have?

Show the answer

Each pair of the 66 vertices is joined once: (62)=15\binom62=15 edges (also 6⋅5/2=156\cdot5/2=15).

Keep going with practice

Vidi's linear algebra lessons connect graphs to matrices through adjacency matrices.