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.
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.
| Term | May repeat edges? | May repeat vertices? | GATE cue |
|---|---|---|---|
| Walk | Yes | Yes | Most general |
| Trail | No | Yes | Euler ideas |
| Path | No | No | Distance / connectivity |
| Cycle | No | Only start=end | Bipartite 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_n | n | n(n−1)/2 | (n−1)-regular |
| K_{m,n} | m+n | m·n | Bipartite |
| C_n | n | n | 2-regular |
| Tree T | n | n−1 | Connected + 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).
| Property | What is covered once? | Classic criterion (undirected) |
|---|---|---|
| Euler circuit | Every edge | Connected + all degrees even |
| Euler trail | Every edge | Connected + exactly 0 or 2 odd degrees |
| Hamilton cycle | Every vertex | No 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).
10 GATE-style MCQs for Graph Theory Basics with full explanations. Attempt each question before revealing the answer.
In a simple undirected graph, the number of vertices of odd degree is:
Show answer & explanation
Answer: B
Handshaking: Σ deg = 2|E| is even, so the count of odd summands must be even.
The maximum number of edges in a simple undirected graph with n vertices is:
Show answer & explanation
Answer: C
Achieved by K_n: every pair among n vertices contributes one edge → C(n,2)=n(n−1)/2.
Which of the following is TRUE for every tree with n≥2 vertices?
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.
Number of edges in the complete bipartite graph K_{3,4} is:
Show answer & explanation
Answer: B
|E(K_{m,n})|=m·n = 3·4 = 12.
Which graph has an Euler circuit?
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).
A connected graph with 10 vertices has 12 edges. The minimum number of edges to remove to make it a tree is:
Show answer & explanation
Answer: C
A tree on 10 vertices has 9 edges. Remove 12−9=3 edges (destroy all cycles).
Which of the following graphs is NOT bipartite?
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.
If G is a simple graph with 6 vertices and 9 edges, the number of edges in the complement Ḡ is:
Show answer & explanation
Answer: A
C(6,2)=15. |E(Ḡ)|=15−9=6.
Which statement is FALSE?
Show answer & explanation
Answer: C
Exactly two odd-degree vertices ⇒ Euler trail exists, but an Euler circuit needs zero odd-degree vertices (all even).
In a k-regular graph on n vertices, the number of edges is:
Show answer & explanation
Answer: B
Σ deg = kn = 2|E| ⇒ |E|=kn/2 (so kn must be even).
Extra page-specific practice beyond the GATE samples. Attempt all 10, then reveal answers to check your reasoning.
Sum of degrees in a graph with 15 edges is:
Show answer & explanation
Answer: B) 30
Σ deg = 2|E| = 30.
Maximum edges in a simple graph on 8 vertices is:
Show answer & explanation
Answer: A) 28
C(8,2)=28.
A tree has 2 vertices of degree 3, 1 of degree 2, and the rest leaves. Number of vertices is:
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.
Which degree sequence is graphic for a simple graph?
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).
Number of edges to remove from K_5 to obtain a spanning tree is:
Show answer & explanation
Answer: D) 6
K_5 has C(5,2)=10 edges; spanning tree has 4 ⇒ remove 6.
K_{2,3} has an Euler trail but no Euler circuit because:
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.
How many edges does the complement of K_{3,3} have? (K_{3,3} on 6 vertices)
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).
Which graph is 3-regular (cubic) among the following?
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.
A forest has 25 vertices and 22 edges. Number of components is:
Show answer & explanation
Answer: B) 3
|E|=n−k ⇒ 22=25−k ⇒ k=3.
Which statement about C_7 is TRUE?
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.
Hover a card to reveal the answer with a 3D flip. On touch devices, tap the card or use Show answer.