Skip to main content

Engineering Mathematics

Graph Theory Basics

Master degree sums, trees, bipartite structure, and Euler criteria so Discrete Maths graph MCQs become fast pattern checks — then lock marks with GATE-style samples and flashcards.

~6 hrs Shared with Discrete / Algo 10 samples · 10 practice · 10 cards

GATE CSE graph theory — handshaking, degree sequences, connectivity, trees, bipartite & complete graphs, Euler/Hamilton definitions, sample GATE questions, flashcards, and practice drills.

Learning outcomes

  • Apply the handshaking lemma and reject impossible degree sequences
  • Use tree identities (|E|=n−1, unique paths, leaf counts) under exam pressure
  • Distinguish walks, trails, paths, cycles, and Euler vs Hamiltonian criteria
  • Count edges in K_n, K_{m,n}, cycles, and complements used in GATE stems
  • Solve GATE-style graph MCQs with a clear explanation trail

Undirected graph vocabulary

  • A simple undirected graph G=(V,E) has no loops and no multiple edges between the same pair.
  • Order n = |V|; size m = |E|. Adjacent vertices share an edge; incident means a vertex meets an edge.
  • Degree deg(v) = number of edges at v. Isolated vertex: deg=0. Leaf (pendant): deg=1.
  • Walk: vertex–edge sequence. Trail: walk with no repeated edge. Path: walk with no repeated vertex. Cycle: closed path of length ≥3.
  • Subgraph uses a subset of vertices/edges. Induced subgraph keeps every edge of G among the chosen vertices.
TermMay repeat edges?May repeat vertices?GATE cue
WalkYesYesMost general
TrailNoYesEuler ideas
PathNoNoDistance / connectivity
CycleNoOnly start=endBipartite test

Handshaking & degree sequences

  • Handshaking lemma: Σ_v deg(v) = 2|E|. Immediate: sum of degrees is even.
  • The number of odd-degree vertices is even (pair them).
  • A sequence d1≥…≥dn of non-negative integers is graphic (simple graph) only if sum even and it passes Havel–Hakimi / Erdős–Gállai style checks — GATE often uses small n by hand.
  • In a simple graph on n vertices, 0 ≤ deg(v) ≤ n−1. You cannot have both a vertex of degree n−1 and an isolated vertex.
  • Pigeonhole on degrees: in any simple graph with n≥2, at least two vertices share the same degree.

Formulas to remember

  • Σ deg(v) = 2|E|
  • # odd-degree vertices is even
  • 0 ≤ deg(v) ≤ n−1 (simple graph)

Worked example

Problem. Can (3,3,3,1) be the degree sequence of a simple graph on 4 vertices?

Solution. Sum = 10 (even) so handshaking parity is OK, but max degree in K_4 is 3 and four vertices of high degree force multiple edges or a contradiction under Havel–Hakimi: take 3,3,3,1 → connect first to next three → remaining (2,2,0) after sorting becomes (2,2,0); next step fails for a simple graph. Alternatively: three vertices of degree 3 means the graph is nearly complete, leaving no room for a degree-1 vertex. So not graphic as a simple graph.

Standard families & edge counts

  • Complete graph K_n: every pair adjacent → |E| = C(n,2) = n(n−1)/2; every deg = n−1.
  • Path P_n (n vertices): n−1 edges; two leaves, internal deg 2.
  • Cycle C_n (n≥3): n edges; 2-regular. C_n is bipartite iff n is even.
  • Complete bipartite K_{m,n}: every vertex of the m-side joins every vertex of the n-side → |E| = m·n; degrees are n (on m-side) and m (on n-side).
  • Complement Ḡ of a simple G on n vertices: same V; uv is an edge in Ḡ iff it is not an edge in G. |E| + |E(Ḡ)| = C(n,2).
  • Regular graph: all degrees equal. k-regular on n vertices ⇒ kn = 2|E|.

Formulas to remember

  • |E(K_n)| = n(n−1)/2
  • |E(K_{m,n})| = m·n
  • |E(C_n)| = n
  • |E| + |E(Ḡ)| = C(n,2)
Graph|V||E|Notes
K_nnn(n−1)/2(n−1)-regular
K_{m,n}m+nm·nBipartite
C_nnn2-regular
Tree Tnn−1Connected + acyclic

Worked example

Problem. How many edges does the complement of C_5 have?

Solution. C_5 has 5 edges on 5 vertices. C(5,2)=10 ⇒ |E(Ḡ)| = 10−5 = 5. (Complement of C_5 is again C_5.)

Connectivity

  • Connected: a path exists between every pair of vertices. Otherwise the graph splits into connected components.
  • Bridge (cut-edge): edge whose removal increases the number of components. Cut-vertex: vertex whose removal increases components.
  • In a connected graph, every bridge lies on every path between its two sides.
  • Distance dist(u,v) = length of a shortest u–v path; diameter = max distance over pairs in a connected graph.
  • Directed graphs use weakly/strongly connected notions — GATE Discrete usually stays undirected unless the stem says otherwise.

Trees

  • Equivalent characterisations (any one implies the others for finite graphs): connected + acyclic; connected with |E|=n−1; acyclic with |E|=n−1; unique path between every pair; minimally connected (removing any edge disconnects).
  • Every tree with n≥2 has at least two leaves.
  • Adding any new edge to a tree creates exactly one cycle; removing any edge from that cycle restores a tree (spanning-tree exchange idea).
  • A spanning tree of connected G has n−1 edges. Number of spanning trees of K_n is n^{n−2} (Cayley) — rare but memorable.
  • Forest = acyclic graph = disjoint union of trees. If a forest has k components on n vertices, |E|=n−k.

Formulas to remember

  • Tree: |E| = |V| − 1
  • Forest with k components: |E| = |V| − k
  • Cayley: τ(K_n) = n^{n−2}

Worked example

Problem. A connected graph has 12 vertices and 15 edges. How many edges must you remove to obtain a spanning tree?

Solution. Any spanning tree has 12−1=11 edges. Remove 15−11=4 edges (that break all cycles, i.e. leave a tree).

Bipartite graphs

  • G is bipartite iff V = A ∪ B (disjoint) and every edge has one end in A and one in B.
  • Characterisation: G is bipartite iff it contains no odd cycle.
  • Trees are bipartite. Even cycles are bipartite; odd cycles are not.
  • K_{m,n} is the complete bipartite archetype. K_n is bipartite only for n≤2.
  • 2-colouring test: BFS/DFS colour vertices with two colours; a conflict ⇒ odd cycle.

Worked example

Problem. Is C_6 bipartite? Is K_3 bipartite?

Solution. C_6 is an even cycle → bipartite (two equal parts of 3). K_3 ≅ C_3 has an odd cycle → not bipartite.

Eulerian & Hamiltonian ideas

  • Euler trail: trail that uses every edge exactly once. Euler circuit (tour): closed Euler trail.
  • Undirected connected G has an Euler circuit ⇔ every vertex has even degree.
  • Undirected connected G has an Euler trail but not a circuit ⇔ exactly two vertices have odd degree (trail starts/ends there).
  • Hamiltonian path/cycle visits every vertex exactly once (cycle returns). No simple degree test like Euler — GATE asks definitions, small forced examples, or Dirac/Ore only rarely at statement level.
  • Do not confuse “every edge once” (Euler) with “every vertex once” (Hamilton).
PropertyWhat is covered once?Classic criterion (undirected)
Euler circuitEvery edgeConnected + all degrees even
Euler trailEvery edgeConnected + exactly 0 or 2 odd degrees
Hamilton cycleEvery vertexNo simple local test; small cases

Worked example

Problem. Does K_{2,3} have an Euler circuit? An Euler trail?

Solution. K_{2,3} is connected. Degrees: two vertices deg 3 (odd), three vertices deg 2 (even). Exactly two odd degrees ⇒ Euler trail exists, but not an Euler circuit.

Where Maths ends and Algorithms begin

  • Engineering Mathematics / Discrete: counts, definitions, trees, bipartite, Euler criteria, simple isomorphism on tiny graphs.
  • Algorithms paper: BFS/DFS, shortest paths, MST, topological order, matching algorithms.
  • Adjacency matrix vs list, incidence matrix — know what they store; matrix powers counting walks is a light Discrete crossover.
  • Planarity (Euler’s formula V−E+F=2) and chromatic number χ(G) appear occasionally; know χ(K_n)=n, χ(bipartite)≤2, four-colour theorem statement only.

Exam tips

  • Before accepting a degree sequence, check: sum even, each deg ≤ n−1, and “deg n−1 together with deg 0” impossibility.
  • For trees, jump to |E|=n−1, ≥2 leaves, and unique-path properties.
  • Euler ≠ Hamiltonian — write “edges” vs “vertices” on scrap paper before picking an option.
  • Bipartite check = hunt for an odd cycle; even length alone does not make a non-cycle graph bipartite without a partition.
  • Complement questions: compute C(n,2) − |E| first.
  • K_{m,n} edge count is just m·n — do not use C(m+n,2).
Exam pattern · 10 questions

GATE sample questions & answers

10 GATE-style MCQs for Graph Theory Basics with full explanations. Attempt each question before revealing the answer.

Q1 Handshaking parity — GATE staple

In a simple undirected graph, the number of vertices of odd degree is:

  • A) Always odd
  • B) Always even
  • C) Always zero
  • D) Equal to the number of edges
Show answer & explanation

Answer: B

Handshaking: Σ deg = 2|E| is even, so the count of odd summands must be even.

Q2 Complete graph edge count

The maximum number of edges in a simple undirected graph with n vertices is:

  • A) n
  • B) n(n−1)
  • C) n(n−1)/2
  • D) 2n
Show answer & explanation

Answer: C

Achieved by K_n: every pair among n vertices contributes one edge → C(n,2)=n(n−1)/2.

Q3 Tree leaf property

Which of the following is TRUE for every tree with n≥2 vertices?

  • A) It has exactly n edges
  • B) It has at least two vertices of degree 1
  • C) It contains a cycle of length 3
  • D) It is 2-regular
Show answer & explanation

Answer: B

Trees have n−1 edges (not n), are acyclic (so no C_3), and are not 2-regular. Every tree with n≥2 has ≥2 leaves.

Q4 Bipartite edge count

Number of edges in the complete bipartite graph K_{3,4} is:

  • A) 7
  • B) 12
  • C) 6
  • D) 24
Show answer & explanation

Answer: B

|E(K_{m,n})|=m·n = 3·4 = 12.

Q5 Euler circuit criterion

Which graph has an Euler circuit?

  • A) K_{2,3}
  • B) K_3
  • C) A path on 4 vertices
  • D) Any tree with 5 vertices
Show answer & explanation

Answer: B

K_3 is connected and 2-regular (all degrees even) ⇒ Euler circuit. K_{2,3} has odd degrees; a path and a tree have leaves (deg 1).

Q6 Spanning tree from connected graph

A connected graph with 10 vertices has 12 edges. The minimum number of edges to remove to make it a tree is:

  • A) 1
  • B) 2
  • C) 3
  • D) 4
Show answer & explanation

Answer: C

A tree on 10 vertices has 9 edges. Remove 12−9=3 edges (destroy all cycles).

Q7 Odd-cycle bipartite test

Which of the following graphs is NOT bipartite?

  • A) C_6
  • B) K_{2,5}
  • C) Any tree
  • D) C_5
Show answer & explanation

Answer: D

Bipartite ↔ no odd cycle. C_5 is an odd cycle. C_6, K_{2,5}, and trees have no odd cycles.

Q8 Complement edge count

If G is a simple graph with 6 vertices and 9 edges, the number of edges in the complement Ḡ is:

  • A) 6
  • B) 9
  • C) 15
  • D) 21
Show answer & explanation

Answer: A

C(6,2)=15. |E(Ḡ)|=15−9=6.

Q9 Euler trail vs circuit

Which statement is FALSE?

  • A) Every Eulerian circuit is a closed trail
  • B) Every Hamiltonian cycle visits every vertex exactly once before returning
  • C) A connected graph with exactly two odd-degree vertices has an Euler circuit
  • D) Σ deg(v) is always even
Show answer & explanation

Answer: C

Exactly two odd-degree vertices ⇒ Euler trail exists, but an Euler circuit needs zero odd-degree vertices (all even).

Q10 Regular graph edge formula

In a k-regular graph on n vertices, the number of edges is:

  • A) kn
  • B) kn/2
  • C) n/k
  • D) k(n−1)/2
Show answer & explanation

Answer: B

Σ deg = kn = 2|E| ⇒ |E|=kn/2 (so kn must be even).

Topic drill · 10 questions

10 practice questions — Graph Theory Basics

Extra page-specific practice beyond the GATE samples. Attempt all 10, then reveal answers to check your reasoning.

P1

Sum of degrees in a graph with 15 edges is:

  • A) 15
  • B) 30
  • C) 14
  • D) 225
Show answer & explanation

Answer: B) 30

Σ deg = 2|E| = 30.

P2

Maximum edges in a simple graph on 8 vertices is:

  • A) 28
  • B) 56
  • C) 64
  • D) 16
Show answer & explanation

Answer: A) 28

C(8,2)=28.

P3

A tree has 2 vertices of degree 3, 1 of degree 2, and the rest leaves. Number of vertices is:

  • A) 5
  • B) 6
  • C) 7
  • D) 8
Show answer & explanation

Answer: B) 6

Let n vertices, ℓ leaves (deg 1). Σ deg = 2(n−1). So 3+3+2+ℓ = 2n−2, and n=3+ℓ → 8+ℓ = 2(3+ℓ)−2 = 4+2ℓ → ℓ=4, n=6.

P4

Which degree sequence is graphic for a simple graph?

  • A) (2,2,2,2)
  • B) (3,3,3,1)
  • C) (4,3,2,1,0)
  • D) (5,3,2,2,2)
Show answer & explanation

Answer: A) (2,2,2,2)

(2,2,2,2) is C_4. (3,3,3,1) fails simple-graph checks; (4,3,2,1,0) has deg 4 and deg 0 together on 5 vertices; (5,3,2,2,2) has deg 5 on only 5 vertices (max 4).

P5

Number of edges to remove from K_5 to obtain a spanning tree is:

  • A) 1
  • B) 4
  • C) 5
  • D) 6
Show answer & explanation

Answer: D) 6

K_5 has C(5,2)=10 edges; spanning tree has 4 ⇒ remove 6.

P6

K_{2,3} has an Euler trail but no Euler circuit because:

  • A) It is disconnected
  • B) It has exactly two odd-degree vertices
  • C) It has an odd cycle
  • D) It is not bipartite
Show answer & explanation

Answer: B) It has exactly two odd-degree vertices

Connected bipartite graph; degrees 3,3,2,2,2 → exactly two odds ⇒ Euler trail, not circuit.

P7

How many edges does the complement of K_{3,3} have? (K_{3,3} on 6 vertices)

  • A) 6
  • B) 9
  • C) 12
  • D) 15
Show answer & explanation

Answer: A) 6

K_{3,3} has 9 edges; C(6,2)=15 ⇒ complement has 6 edges (two disjoint triangles on the parts).

P8

Which graph is 3-regular (cubic) among the following?

  • A) K_4
  • B) C_5
  • C) K_{2,3}
  • D) P_4
Show answer & explanation

Answer: A) K_4

K_4 is 3-regular. C_5 is 2-regular; K_{2,3} has degrees 3 and 2; P_4 has leaves.

P9

A forest has 25 vertices and 22 edges. Number of components is:

  • A) 2
  • B) 3
  • C) 4
  • D) 5
Show answer & explanation

Answer: B) 3

|E|=n−k ⇒ 22=25−k ⇒ k=3.

P10

Which statement about C_7 is TRUE?

  • A) It is bipartite
  • B) It is a tree
  • C) It has exactly 7 edges and is 2-regular
  • D) Every vertex has odd degree
Show answer & explanation

Answer: C) It has exactly 7 edges and is 2-regular

C_7 is a 7-cycle: 7 edges, every degree 2 (even). It is an odd cycle ⇒ not bipartite, not a tree.

Topic FAQs

Is graph theory part of Engineering Mathematics or Algorithms in GATE?

Structural basics appear under Discrete Mathematics / Engineering Mathematics. BFS, DFS, MST, and shortest paths appear under Algorithms. Learn definitions once — they are shared.

What is the fastest Euler-circuit check in an MCQ?

Confirm the graph is connected (or that all edges lie in one connected component), then check that every vertex degree is even. One odd degree kills the circuit.

How do I remember tree equivalences?

Connected + no cycles ⇔ |E|=n−1 + connected ⇔ unique path between every pair. Any extra edge creates a cycle; any missing edge (from n−1) disconnects.

When is a complete graph bipartite?

Only K_1 and K_2 (no odd cycle). K_3 and larger contain triangles.

Quick revision · 10 cards

10 flashcards — Graph Theory Basics

Hover a card to reveal the answer with a 3D flip. On touch devices, tap the card or use Show answer.

Q1 State the handshaking lemma and its odd-degree corollary.
Q2 How many edges does K_n have? How many does K_{m,n} have?
Q3 Give three equivalent characterisations of a tree on n vertices.
Q4 When does a connected undirected graph have an Euler circuit?
Q5 When does a connected undirected graph have an Euler trail that is not a circuit?
Q6 How can you test whether a graph is bipartite?
Q7 What is the difference between an Euler circuit and a Hamiltonian cycle?
Q8 How many edges are in the complement of a simple graph G on n vertices with m edges?
Q9 How many edges does a forest with n vertices and k components have?
Q10 Why can a simple graph not have both a vertex of degree n−1 and an isolated vertex?