Skip to content
GATEiit

GATE CSE · Engineering Mathematics

Graphs: connectivity, matching and colouring

Degrees and the handshaking lemma, connectivity, components, cut vertices and Euler tours, matchings and Hall's theorem, vertex and edge covers, chromatic number, chromatic polynomials and planar graphs.

Before you start

  • Sets and relations →

    A graph is a vertex set with a symmetric relation; components are equivalence classes of reachability.

  • Counting →

    Counting edges, matchings and colourings uses binomial coefficients and the product rule.

  • Graph representations →

    Adjacency lists and matrices make degree and reachability arguments concrete.

This topic comes before: Graphs

Concept notes

1. Degrees, edges and special graphs

A simple graph has no loops and no multiple edges. The degree deg⁡(v) is the number of edges at v; δ and Δ are the minimum and maximum degrees.

Handshaking lemma: ∑vdeg⁡(v)=2∣E∣. So the number of odd-degree vertices is always even.

Graph Vertices Edges Note
Complete Kn n (n2) (n−1)-regular
Complete bipartite Km,n m+n mn
Cycle Cn n n 2-regular
Tree n n−1 connected, no cycle
Forest with k trees n n−k
k-regular graph n nk/2 needs nk even

There are 2(n2) labelled simple graphs on n vertices. The complement G‾ has the same vertices and exactly the edges missing from G, so ∣E(G)∣+∣E(G‾)∣=(n2).

Is a degree sequence graphical? (Havel-Hakimi) Sort in non-increasing order, remove the first value d, subtract 1 from the next d values, re-sort and repeat. The sequence is graphical if you reach all zeros, and not graphical if a negative appears or d exceeds the number of remaining entries. An odd degree sum fails at once.

2. Connectivity and Euler tours

A graph is connected if every pair of vertices has a path between them. Maximal connected pieces are components.

Edge bounds for a simple graph on n vertices:

  • with k components, at most (n−k)(n−k+1)2 edges (one big complete graph plus k−1 isolated vertices);
  • with more than (n−12) edges it must be connected;
  • a connected graph needs at least n−1 edges.

A cut vertex (articulation point) is a vertex whose removal increases the number of components; a bridge (cut edge) is such an edge. An edge is a bridge exactly when it lies on no cycle. Every non-leaf vertex of a tree is a cut vertex and every tree edge is a bridge.

Vertex connectivity κ(G) is the fewest vertices whose removal disconnects G (or leaves one vertex); edge connectivity λ(G) is the fewest such edges. Whitney: κ≤λ≤δ. For Kn, κ=λ=n−1.

Euler tours (use every edge once):

Graph (connected, ignoring isolated vertices) Euler circuit Euler path (not closed)
every degree even yes no
exactly 2 odd vertices no yes, from one odd vertex to the other
more than 2 odd vertices no no

Hamiltonian cycles (visit every vertex once) have no easy test. A sufficient condition (Dirac): n≥3 and δ≥n/2. Kn for n≥3 is Hamiltonian; Km,n is Hamiltonian only when m=n≥2.

3. Matchings and covers

A matching is a set of edges with no shared vertex. A maximal matching cannot be extended by adding an edge; a maximum matching has the largest size ν(G). A perfect matching covers every vertex, so it needs n even and has n/2 edges.

Counts: K2m has (2m−1)(2m−3)⋯3⋅1=(2m)!2m m! perfect matchings; Kn,n has n!.

Hall's marriage theorem: a bipartite graph with parts X,Y has a matching that saturates X if and only if ∣N(S)∣≥∣S∣ for every S⊆X, where N(S) is the set of neighbours of S. One set S with ∣N(S)∣<∣S∣ proves no such matching exists. A k-regular bipartite graph (k≥1) always has a perfect matching.

Covers and independent sets:

Quantity Definition
Independence number α largest set of pairwise non-adjacent vertices
Vertex cover β fewest vertices touching every edge
Edge cover ρ fewest edges touching every vertex (no isolated vertices)

Relations:

  • α+β=n, since the complement of an independent set is a vertex cover.
  • ν+ρ=n (Gallai, no isolated vertices).
  • ν≤β always.
  • König: in a bipartite graph ν=β.
x1x2x3x4y1y2y3y4thick = matched edge, dashed = unmatched edge
A bipartite graph with a perfect matching (thick edges). Hall's condition holds for every subset of the top row.

4. Vertex colouring and the chromatic number

A proper colouring gives adjacent vertices different colours. The chromatic number χ(G) is the fewest colours needed.

Graph χ
Kn n
no edges 1
bipartite with at least one edge, any tree with 2 or more vertices 2
Cn, n even 2
Cn, n odd 3
wheel with n rim vertices 3 if n even, 4 if n odd
planar at most 4 (four colour theorem)

Key facts:

  • G is bipartite   ⟺   χ(G)≤2   ⟺   G has no odd cycle.
  • Lower bounds: χ≥ω (clique number) and χ≥n/α (each colour class is an independent set).
  • Upper bounds: χ≤Δ+1 (greedy colouring). Brooks: χ≤Δ for a connected graph that is neither complete nor an odd cycle.
  • χ can exceed ω: C5 has ω=2 but χ=3.

Chromatic polynomial P(G,k) = number of proper colourings with k available colours. The smallest k with P(G,k)>0 is χ(G).

Graph P(G,k)
Kn k(k−1)(k−2)⋯(k−n+1)
tree on n vertices k(k−1)n−1
Cn (k−1)n+(−1)n(k−1)

Edge colouring: the edge chromatic number χ′ is Δ or Δ+1 (Vizing), and χ′=Δ for bipartite graphs.

121234labels are colour numbersrim: odd cycle C5, needs 3hub: adjacent to all, needs a 4th
A proper 4-colouring of the wheel with 5 rim vertices; 3 colours are not enough.

5. Planar graphs

A graph is planar if it can be drawn in the plane with no edges crossing. The drawing splits the plane into faces, including the unbounded outer face.

Euler's formula for a connected planar graph: v−e+f=2. With k components: v−e+f=k+1.

Each face is bounded by at least 3 edges (simple graph, v≥3), and each edge borders at most 2 faces, so 3f≤2e. Combining with Euler:

Condition Bound
simple planar, v≥3 e≤3v−6
planar, no triangles (for example bipartite), v≥3 e≤2v−4

These bounds are necessary, not sufficient: a graph that breaks one is non-planar, but obeying it proves nothing.

  • K5: e=10>3⋅5−6=9, so non-planar.
  • K3,3: e=9>2⋅6−4=8, so non-planar.
  • Kuratowski: a graph is planar if and only if it has no subdivision of K5 or K3,3.

Every simple planar graph has a vertex of degree at most 5. This is why five colours are easy to prove enough; four colours suffice by the four colour theorem.

Formulas to remember

Handshaking lemma
∑v∈Vdeg⁡(v)=2∣E∣
Maximum edges with k componentsSimple graph on n vertices
(n−k)(n−k+1)2
Euler's formulaConnected planar graph
v−e+f=2
Planar edge bound
e≤3v−6(triangle-free: e≤2v−4)
Perfect matchings in K_2m
(2m)!2m m!=(2m−1)(2m−3)⋯1
Independence and vertex cover
α(G)+β(G)=n
Chromatic polynomial of a cycle
P(Cn,k)=(k−1)n+(−1)n(k−1)
Chromatic polynomial of a tree
P(T,k)=k(k−1)n−1
Bounds on the chromatic number
ω(G)≤χ(G)≤Δ(G)+1

Common mistakes

  • Confusing a maximal matching (cannot be extended) with a maximum matching (largest possible).
  • Using e≤3v−6 to claim a graph is planar; the bound is only necessary.
  • Forgetting the outer face when applying Euler's formula.
  • Assuming χ=ω; odd cycles and wheels need more colours than their largest clique.
  • Mixing up Euler circuits (every edge once, all degrees even) with Hamiltonian cycles (every vertex once, no simple test).
  • Counting perfect matchings of K2m as (2m)!/2m without dividing by m! for the order of the pairs.

Worked examples

Try each step yourself, then reveal the working.

Example 1: Is the degree sequence graphical?

numerical

Decide whether a simple graph exists with degree sequence (a) 3, 3, 3, 1 and (b) 3, 3, 2, 2, 2.

  1. Step 1: Check (a) directly, then with Havel-Hakimi.

    Try it on paper first.

Example 2: Hall's condition and a maximum matching

numerical

Bipartite graph with X={a,b,c}, Y={1,2,3} and edges a1,b1,c1,c2,c3. Is there a matching saturating X? Find ν and a minimum vertex cover.

  1. Step 1: Look for a subset S of X with few neighbours.

    Try it on paper first.

Example 3: Counting proper colourings

numerical

With 3 colours available, how many proper colourings does (a) a path on 5 vertices and (b) the cycle C5 have?

  1. Step 1: Colour the path one vertex at a time.

    Try it on paper first.

Example 4: Proving K5 and K3,3 are not planar

conceptual

Use the edge bounds to show that K5 and K3,3 are not planar. Why is the second bound needed for K3,3?

  1. Step 1: Apply e ≤ 3v − 6 to K5.

    Try it on paper first.

Previous year questions

20 official GATE CSE questions on this topic, newest first.

Practise these 20 PYQs →

Topic test

10 questions: up to 4 official PYQs and original practice questions, with GATE marking (MCQ wrong answers lose marks). Score 60% or more to pass. A new set is drawn each time.

Mark as mastered

Loading your progress…

My revision notes

Notes written by the GATEiit team against the official GATE CSE syllabus; being checked by a reviewer. Updated 2026-11-21. Spotted a mistake? Use Report an issue on any question, or contact us.