Graph Theory
5.1 Definitions
A graph consists of a set of vertices and a set of edges .
- Simple graph: no loops, no multiple edges.
- Directed graph (digraph): edges have direction.
- Weighted graph: edges have weights.
The degree of a vertex , Is the number of edges incident to .
Theorem 5.1 (Handshaking Lemma). .
Proof. Each edge contributes 1 to the degree of each of its two endpoints.
Corollary 5.2. The number of vertices of odd degree is even.
5.2 Paths, Cycles, and Connectivity
A walk is a sequence of vertices where consecutive vertices are adjacent. A path is a walk With no repeated vertices. A cycle is a path that returns to its starting vertex.
A graph is connected if there is a path between every pair of vertices. A connected component Is a maximal connected subgraph.
Theorem 5.3. A graph with vertices and more than edges is connected.
5.3 Trees
A tree is a connected acyclic graph. A forest is a disjoint union of trees.
Theorem 5.4. For a graph with vertices, the following are equivalent:
- is a tree.
- is connected and has edges.
- is acyclic and has edges.
- Between any two vertices, there is exactly one path.
Cayley”s Formula. The number of labelled trees on vertices is .
5.4 Planarity
A graph is planar if it can be drawn in the plane with no edge crossings.
Theorem 5.5 (Euler’s Formula for Planar Graphs). For a connected planar graph drawn in the plane With vertices, edges, and faces:
Proof sketch. Build the graph edge by edge. Starting from a single vertex (, , ), The quantity is preserved when adding an edge: if the edge connects two components, and each increase by 1; if it splits a face, and each increase by 1.
Corollary 5.6. For a simple planar graph with : .
Proof. Every face has at least 3 edges on its boundary, and every edge borders at most 2 faces, So . By Euler’s formula, Giving I.e., .
Corollary 5.7. and are not planar.
Proof. has , But . For , , . Since has no triangles, every face has at least 4 edges, giving So . But gives . Contradiction.
Theorem 5.8 (Kuratowski’s Theorem). A graph is planar if and only if it does not contain a Subdivision of or as a subgraph.
A subdivision of an edge replaces with a path —— through a new vertex . A graph is a subdivision of if can be obtained from by subdividing edges.
Worked Example. Show that is not planar using Euler’s formula.
Solution
has vertices and edges. It is bipartite (partition sizes 3 and 3), so it Contains no triangles. Every face in a planar embedding must therefore be bounded by at least 4 edges, Giving I.e., .
But Euler’s formula gives . Since No planar embedding Exists.
5.5 Graph Colouring
A proper -colouring assigns one of colours to each vertex such that adjacent vertices have Different colours. The chromatic number is the minimum for which a proper -colouring Exists.
Theorem 5.9 (Four Colour Theorem). Every planar graph is 4-colourable.
Theorem 5.10 (Five Colour Theorem). Every planar graph is 5-colourable. (Easier to prove.)
Theorem 5.11 (Greedy Colouring Bound). where is the Maximum degree.
Theorem 5.12 (Brooks’ Theorem). If is connected and is neither a complete graph nor an odd Cycle, then .
Chromatic polynomial. The chromatic polynomial counts the number of proper -colourings of .
Theorem 5.13. is a polynomial in .
Deletion-contraction recurrence. For any edge of :
Where is with edge deleted, and is with contracted (its endpoints Merged).
Worked Example. Find the chromatic polynomial of (the 4-cycle).
Solution
Label the vertices of as with edges , , , .
Pick edge .
is a path on 4 vertices (a tree): .
merges and Yielding (triangle): .
Therefore .
Checking: (two 2-colourings: alternating), and .
Worked Example. Find and .
Solution
(complete graph on vertices): every pair of vertices is adjacent, so all vertices must Receive distinct colours. Hence .
(complete bipartite graph): no two vertices within the same partition are adjacent, so we Can colour all vertices in the first partition with colour 1 and all in the second with colour 2. Hence (for ).
Worked Example. Find the chromatic polynomial of (triangle).
Solution
Choose a colour for vertex 1: choices. Choose a colour for vertex 2 (different from vertex 1): choices. Choose a colour for vertex 3 (different from both): choices.
.
Checking: (not 2-colourable, as expected). .
5.6 Euler and Hamilton Paths
An Euler path visits every edge exactly once. An Euler circuit is an Euler path that starts And ends at the same vertex.
Theorem 5.14. A connected graph has an Euler circuit if and only if every vertex has even degree. It has an Euler path (but not circuit) if and only if exactly two vertices have odd degree.
Proof (sufficiency). If every vertex has even degree, start at any vertex and follow edges, never Reusing an edge. Since all degrees are even, the walk can only terminate at the starting vertex, Forming a circuit . If uses all edges, we are done. Otherwise, remove ‘s edges; each Remaining component has all vertices of even degree (each lost an even number of incident edges). By induction, each component has an Euler circuit. Splicing these circuits into at shared Vertices yields an Euler circuit of the full graph.
Worked Example. Does have an Euler circuit? An Euler path?
Solution
has 5 vertices. The two vertices in the first partition each have degree 3 (connected to All three in the second partition). The three vertices in the second partition each have degree 2.
Vertices of odd degree: two (each of degree 3). Since exactly two vertices have odd degree, has an Euler path (starting at one odd-degree vertex, ending at the other) but not an Euler circuit.
A Hamilton path visits every vertex exactly once. A Hamilton circuit is a Hamilton path that Returns to the start.
Theorem 5.15 (Dirac’s Theorem). If is a simple graph with vertices and for every vertex, then has a Hamilton circuit.
Theorem 5.16 (Ore’s Theorem). If is a simple graph with vertices and for every pair of non-adjacent vertices Then has a Hamilton Circuit.
Note that Dirac’s theorem is a corollary of Ore’s theorem.
Worked Example. Does have a Hamilton circuit?
Solution
has 5 vertices. A Hamilton circuit must visit all 5 vertices and return. Label the Partitions as and . Any cycle in a bipartite graph alternates Between the two partitions. A Hamilton cycle would alternate between and Requiring . But So no Hamilton circuit exists.
However, does have Hamilton paths (e.g., — wait, this doesn’t Alternate properly). Actually, in edges only exist between and . A path must alternate or . A Hamilton path visits all 5 vertices, so it has the Form (length 5, starting and ending in ) or (length 5, starting And ending in ). The first requires 3 vertices from But . The second requires 3 Vertices from And . So a Hamilton path exists: e.g., .
Worked Example. Let have vertices and edges . Does have an Euler circuit or Euler path?
Solution
Degrees: , , , , . Two vertices (1 and 5) have odd degree. Since exactly two vertices have odd degree, has an Euler Path (starting at 1, ending at 5) but no Euler circuit.
One Euler path: . All 7 edges are used exactly once. ✓
Algorithm (Hierholzer’s). To find an Euler circuit: start at any vertex, follow unused edges Until returning to the start. If unused edges remain, find a vertex on the current circuit with Unused edges, find a subtour, and splice it in. Repeat until all edges are used.
:::caution Common Pitfall Determining whether a graph has a Hamilton path/circuit is NP-complete , whereas Euler Paths/circuits can be determined in polynomial time using the degree condition. Do not confuse the two.
5.7 Matching Theory
A matching in a graph is a set of pairwise disjoint edges (no two share an Endpoint). A vertex is matched if it is an endpoint of an edge in ; otherwise it is unmatched. A perfect matching covers every vertex.
Theorem 5.17 (Hall’s Marriage Theorem, 1935). Let be a bipartite graph with Partitions and . There exists a matching that covers every vertex in if and only if for Every subset
Where N(S) = \\{y \in Y : \exists\, x \in S\; \mathrm{with{}\; xy \in E\\} is the neighbourhood of .
Proof (necessity). If a matching covers Each is matched to a distinct So .
Proof (sufficiency by induction on ). Base case : Hall’s condition gives So has a neighbour, and we can match to it.
Inductive step. Consider two cases.
Case 1: For every nonempty proper subset , . Pick any edge . In Hall’s condition still holds (removing one element from each side preserves the Strict inequality). By the induction hypothesis, can be matched in . Adding Gives the desired matching.
Case 2: There exists a nonempty proper with . Match to By the induction hypothesis. In For any So
Where the inequality uses Hall’s condition on in . By the induction hypothesis, can be matched in . Combining with the matching on gives the result.
Worked Example. Let and with edges —; —; —; —. Does a matching covering exist?
Solution
Check Hall’s condition for every subset :
- : each vertex has at least 1 neighbour. ✓
- : , . , . Similarly all pairs have . ✓
- : , . , . All triples have . ✓
- : , . ✓
Hall’s condition is satisfied, so a matching exists. One such matching: —, — —, —.
5.8 Network Flows
A flow network is a directed graph with a source A sink And a capacity function . A flow Satisfies:
- Capacity constraint: for all .
- Flow conservation: for all \sum_{e\; \mathrm{into{}\; v} f(e) = \sum_{e\; \mathrm{out\; of{}\; v} f(e).
The value of a flow is |f| = \sum_{e\; \mathrm{out\; of{}\; s} f(e) - \sum_{e\; \mathrm{into{}\; s} f(e).
An s-t cut partitions into (containing ) and (containing ). The capacity of the cut is .
Theorem 5.18 (Max-Flow Min-Cut Theorem). In any flow network, the maximum value of a flow from to equals the minimum capacity of an - cut.
Proof sketch. Let be a maximum flow. Define the residual graph with the same Vertices and residual capacity for forward edges and For backward edges. Let be the set of vertices reachable from in via edges with Positive residual capacity. Since is maximum, (otherwise we could augment the Flow). The cut has capacity exactly (all forward edges are saturated, All backward edges have zero flow). Therefore minimum cut Capacity Giving equality.
Theorem 5.19 (Integrality Theorem). If all capacities are integers, there exists a maximum flow Where every is an integer.
Corollary 5.20. If all capacities are integers, the maximum flow value is an integer.
The Ford—Fulkerson method repeatedly finds augmenting paths in the residual graph and pushes Flow along them. When capacities are integers, each augmentation increases the flow by at least 1, Guaranteeing termination.
:::