Vertices, edges, the handshaking lemma, and the problems we will model.
Chapter: XIIb — Graph theory · lesson id gt-intro · theory lesson
A $graph$ is the barest description of "things and the connections between them": a set of $vertices$ and a set of $edges$ joining pairs of them. Roads between cities, friendships between people, dependencies between tasks — all graphs. This optional chapter takes three of the most famous questions you can ask about a graph — how few vertices touch every edge, how many vertices you can pick with no edge between them, and how many edges you can pick sharing no vertex — and writes each one as a small integer program you already know how to solve. One graph, three models, two clean theorems tying them together.
Definition (Graph). A $graph$ $G = (V, E)$ is a finite set of $vertices$ $V$ together with a set of $edges$ $E$, where each edge is an unordered pair ${u, v}$ of distinct vertices. Two vertices joined by an edge are $adjacent$; an edge and a vertex it contains are $incident$. Unless we say otherwise the graph is $undirected$ (edges have no direction) and $simple$ (no loops, no repeated edges).
Definition (Degree). The $degree$ $\deg(v)$ of a vertex $v$ is the number of edges incident to it — how many neighbours it has.
Every lesson here works on the same six-vertex graph so you can watch the three answers relate to one another. Its edges are ${1,2}, {1,3}, {1,4}, {2,5}, {4,5}, {5,6}$.
[network-graph diagram: The chapter graph: six vertices, six edges. Vertices 1 and 5 are the hubs (degree 3); vertices 3 and 6 are leaves (degree 1).]
The first thing to know about degrees is that they are not free to be anything — they must add up correctly.
Theorem (Handshaking lemma). In any graph $G = (V, E)$, the sum of the vertex degrees equals twice the number of edges: $$\sum_{v \in V} \deg(v) = 2,|E|.$$ In particular, the number of vertices of odd degree is even.
Proof, step by step (Handshaking lemma).
Check it on our graph: the degrees are $\deg(1)=3,\ \deg(2)=2,\ \deg(3)=1,\ \deg(4)=2,\ \deg(5)=3,\ \deg(6)=1$. Their sum is $3+2+1+2+3+1 = 12 = 2 \times 6$, matching the six edges. Four vertices have odd degree — $1, 3, 5, 6$ — and four is even, exactly as the lemma requires.
Quick check. The handshaking lemma forces the number of odd-degree vertices to be even. Which degree sequence does it rule out on the spot?
Definition (Bipartite graph). A graph is $bipartite$ if its vertices can be split into two sets $A$ and $B$ so that every edge joins a vertex in $A$ to a vertex in $B$ — no edge stays inside $A$ or inside $B$. Equivalently (König, 1936): a graph is bipartite if and only if it contains no cycle of odd length.
Our chapter graph is bipartite: take $A = {1, 5}$ and $B = {2, 3, 4, 6}$ and check that all six edges cross between the two sides. That fact will matter in the last lesson — bipartite graphs make one of our two theorems especially sharp.
Notice cover and independent set are the same skeleton with the inequality flipped and the sense reversed. That is not a coincidence — it is the next lesson.
Recap.
Read this through MCP: read with path: "lessons/gt-intro", or resource hlpl://lessons/gt-intro.