Section 1 · 9 min read
Graph theory
Degrees and edge counts, connectivity and cut sets, trees and spanning trees, Euler and Hamilton paths, planarity, matchings and covers, and vertex and edge colouring.
On this page
Graph theory is the most tested part of discrete mathematics in GATE CS. The syllabus names connectivity, matching and colouring, but questions also use degree counting, trees and Euler's formula as tools. Unless stated otherwise, graphs here are finite, simple and undirected, with vertices and edges.
Degrees and edge counts
Handshaking lemma. . So the number of odd degree vertices is even.
Edge count facts:
- has edges. has edges.
- A -regular graph on vertices has edges, so must be even.
- The complement has edges. A self-complementary graph has edges, so or .
- Number of labelled simple graphs on vertices: .
Graphic sequences (Havel-Hakimi). A non-increasing sequence is the degree sequence of a simple graph iff removing and subtracting 1 from each of the next entries gives a graphic sequence. Repeat until all zeros (graphic) or a negative entry or impossible step appears (not graphic). Quick rejections: odd sum, or some .
Connectivity
A graph is connected if every pair of vertices is joined by a path. The maximal connected subgraphs are the components.
Edge bounds:
- A connected graph needs at least edges.
- A graph with components has at least edges and at most edges (one big clique plus isolated vertices).
- If , the graph must be connected.
- If , the graph is connected.
Cut vertex: removing it increases the number of components. Bridge (cut edge): removing it increases the number of components. An edge is a bridge iff it lies on no cycle.
Vertex connectivity : the fewest vertices whose removal disconnects or leaves one vertex. Edge connectivity : the fewest edges whose removal disconnects . Whitney's inequality: For all three equal . For a tree with at least 2 vertices, .
Menger's theorem. The maximum number of internally vertex-disjoint paths between two non-adjacent vertices equals the minimum number of vertices separating them (and the edge version holds with edge-disjoint paths and edge cuts).
Trees
A tree is a connected acyclic graph. For a graph on vertices, any two of these imply the third: connected, acyclic, .
- Every tree with has at least 2 leaves.
- Between any two vertices there is exactly one path.
- A forest with components has edges.
- Leaves of a tree: , where is the number of vertices of degree .
Counting spanning trees.
- Cayley's formula: has spanning trees (number of labelled trees on vertices).
- has spanning trees.
- has spanning trees (drop any one edge).
- In general, the matrix tree theorem: the count equals any cofactor of the Laplacian .
Euler and Hamilton
- A connected graph has an Euler circuit iff every vertex has even degree, and an Euler path (not circuit) iff exactly two vertices have odd degree.
- A Hamiltonian cycle visits every vertex once. No simple characterization is known. Dirac's sufficient condition: and . Ore's condition: for every non-adjacent pair.
- has distinct Hamiltonian cycles. is Hamiltonian iff .
Planarity
For a connected planar graph with faces (including the outer face), Euler's formula is With components it becomes .
Consequences for simple planar graphs with :
- .
- If there is no triangle, .
- Some vertex has degree at most 5.
() and (, triangle free) are not planar. Kuratowski: a graph is planar iff it has no subdivision of or .
Matchings and covers
A matching is a set of edges with no shared endpoint. A perfect matching covers every vertex, so it needs even and has edges.
| Quantity | Symbol | Meaning |
|---|---|---|
| Matching number | largest matching | |
| Vertex cover number | fewest vertices touching every edge | |
| Independence number | largest set of pairwise non-adjacent vertices | |
| Edge cover number | fewest edges touching every vertex (no isolated vertices) |
Key relations:
- Gallai: . If there are no isolated vertices, .
- Always (each matched edge needs its own cover vertex) and .
- Konig: in a bipartite graph, .
- Hall: a bipartite graph with parts has a matching saturating iff for every .
- Every -regular bipartite graph () has a perfect matching.
Standard counts:
- Perfect matchings in : .
- Perfect matchings in : .
- , , , .
Colouring
A proper vertex colouring gives adjacent vertices different colours. The fewest colours needed is the chromatic number .
Bounds and facts:
- (size of the largest clique) and .
- (greedy colouring). Brooks: unless is a complete graph or an odd cycle.
- iff is bipartite iff has no odd cycle.
- Four colour theorem: every planar graph has .
| Graph | |
|---|---|
| , even / odd | 2 / 3 |
| Tree, | 2 |
| 2 | |
| Wheel (cycle plus hub), even / odd | 3 / 4 |
| Petersen graph | 3 |
Chromatic polynomial counts proper colourings with at most colours:
- : .
- Any tree on vertices: .
- : .
- Deletion-contraction: .
Edge colouring. The chromatic index is or (Vizing). Bipartite graphs have (Konig). for even and for odd .
Worked examples
Worked example 1: Faces of a planar graph
A connected planar simple graph has 10 vertices, each of degree 3. How many faces does a planar drawing have?
- .
- .
Sanity check: .
Worked example 2: Matching versus cover in a non-bipartite graph
Find , , for the cycle .
- : pick alternate vertices; a fourth would sit next to one of them.
- Gallai: .
- : 7 vertices allow at most 3 disjoint edges.
Here . Konig's equality fails because has an odd cycle.
Worked example 3: Chromatic polynomial of a small graph
Count proper colourings with colours of the "triangle with a pendant": vertices form a triangle and is joined only to .
- Triangle: ways.
- must avoid the colour of : ways.
- . With : .
The polynomial is zero at , matching .
Worked example 4: Edges forcing connectivity
What is the smallest such that every simple graph with 9 vertices and edges is connected?
The densest disconnected graph is plus an isolated vertex, with edges. So any graph with edges is connected. Answer: 29.
Worked example 5: Hall's condition
Students list acceptable projects: , , , . Can every student get a distinct project?
Take . , which has 2 elements, fewer than 3. Hall's condition fails, so no such assignment exists. The maximum matching has size 3 (for example , , ).
Common traps
- Using to prove a graph is planar. It is only a necessary condition.
- Forgetting the outer face in Euler's formula.
- Applying Konig's theorem () to non-bipartite graphs.
- Assuming high minimum degree makes large. Two s sharing a vertex have but .
- Counting perfect matchings of as , forgetting that the order of the pairs does not matter.
- Wheel chromatic numbers: with an odd rim needs 4 colours, not 3.
- Treating as "is a tree". Any bipartite graph with an edge has .
Quick revision
- ; odd degree vertices come in even numbers.
- components: .
- .
- Trees: , at least 2 leaves, labelled trees.
- Euler circuit: connected and all degrees even. Euler path: exactly 0 or 2 odd vertices.
- Planar: , , triangle free .
- ; (no isolated vertices); bipartite .
- Perfect matchings: has ; has .
- ; bipartite iff no odd cycle iff .
- ; tree: .