Graph Fundamentals, Trees and Connectivity Notes for Gate Cs
Graph Fundamentals, Trees and Connectivity notes for GATE CS: 40 study cards covering concepts, formulas, shortcuts and exam traps, plus solved practice quest
Graph Fundamentals Trees and Connectivity notes
Chapter Roadmap: Graph Fundamentals, Trees and Connectivity
Chapter Journey
Graph Fundamentals & Connectivity
1. Spanning Tree Enumeration
Counting trees using Cayley’s Formula & Kirchhoff’s Theorem.
2. Weighted Spanning Trees
Optimizing tree weight with Kruskal’s & Prim’s Algorithms.
3. Connectivity & Planarity
Graph robustness, Euler’s Formula, and edge bounds.
4. Matchings & Distances
Pairing vertices, diameter, and graph powers.
Why start here? Counting structures builds the intuition needed to optimize them and analyze their resilience.
Hero Concept: What is a Spanning Tree?
The Spanning Tree
For a connected undirected graph G=(V,E) with ∣V∣=n, a Spanning TreeT is a subgraph that:
1.Includes all vertices: V(T)=V(G)
2.Is connected
3.Is acyclic (No loops)
Critical Property
∣ET∣=n−1
Why Enumerate? Knowing the number of spanning trees, denoted as τ(G), tells us how many unique ways we can connect all nodes without loops.
Worked Example: Kirchhoff on a Sparse Graph
Example: K4 minus one edge
Vertices {1,2,3,4}. All edges present except (3,4).
Degrees: deg(1)=3,deg(2)=3 deg(3)=2,deg(4)=2
Reduce:
Delete Row 4 & Col 4.
Laplacian Matrix L
L=3−1−1−1−13−1−1−1−120−1−102
Reduced Matrix L′
L′=3−1−1−13−1−1−12
Determinant Calculation
det(L′)=3(5)+1(−3)−1(4)=8
Answer: 8 trees
37 more cards in this chapter
Try a question
Answer it here to see how it works. Nothing is recorded until you sign in.
Question 1
Level 1: Warm-up
Consider a connected simple graph with 10 vertices. If we partition its edges into a spanning tree and a set of extra edges, and the total number of edges is 15, how many edges are in the extra set?
Question 2
Level 1: Warm-up
Assertion (A): For a graph with 6 vertices, the reduced Laplacian matrix used in Kirchhoff's theorem is of size 5×5.
Reason (R): The original Laplacian matrix is of size 6×6, and the method requires deleting exactly one row and one column.
Question 3
Level 1: Warm-up
Consider the following:
Assertion (A): A connected planar graph with 10 vertices and 15 edges has 7 faces.
Reason (R): Euler's formula for connected planar graphs states V−E+F=2.
Question 4
Level 1: Warm-up
A connected graph has 4 vertices. The Laplacian matrix is:
L=3−1−1−1−13−1−1−1−120−1−102
If deleting row 4 and column 4 gives determinant 8, what determinant is obtained by deleting row 1 and column 1?
Question 5
Level 1: Warm-up
Consider the following assertion and reason:
Assertion (A): For a connected graph with 4 vertices, if the determinant of the reduced Laplacian matrix (obtained by deleting row 4 and column 4) is 8, then the determinant obtained by deleting row 1 and column 1 is also 8.
Reason (R): According to Kirchhoff's Matrix Tree Theorem, all cofactors of the Laplacian matrix (obtained by deleting row i and column i for any i) are equal.
Which of the following statements are CORRECT?
Question 6
Level 1: Warm-up
Consider a directed graph with 5 vertices labeled 1,2,3,4,5. A directed edge exists from vertex i to vertex j if and only if j<i.
Assertion (A): The number of directed spanning trees rooted at vertex 5 is 24.
Reason (R): In such a graph, every vertex except the root must choose exactly one incoming edge from a vertex with a higher index, and the number of choices for vertex k is 5−k.
Which of the following is correct?
Question 7
Level 1: Warm-up
The number of spanning trees in a complete graph with 5 labeled vertices is
Question 8
Level 1: Warm-up
Which of the following statements about the row sums of the Laplacian matrix L of a simple undirected graph is true?
Question 9
Level 1: Warm-up
If the determinant of the reduced Laplacian matrix of a connected graph is 12, how many spanning trees does the graph have?
Question 10
Level 1: Warm-up
What is the maximum number of edges in a simple disconnected graph with 6 vertices?
Free preview ends here
Login to view the complete notes
Creating an account is free. You get the rest of this chapter, step-by-step solutions, and a study plan built around the topics you are actually weak at.
Most platforms hand everyone the same content. Here the content moves with your performance, topic by topic.
Built around you, not around a syllabus PDF
Every answer you give moves your topic-level intelligence rate. The next question, the next revision card and tomorrow's plan all change with it.
Revision that hits your weak spots
We only revise topics you have actually attempted and are still below the safe bar on — never the same chapter on repeat.
Questions calibrated to the real exam
Each question carries a measured toughness. You are served a rung above your current level, so practice keeps stretching you.
Notes written for recall, not for volume
Full lesson cards for first study, curated short-note cards for the last mile — with derivations, traps and exam patterns marked.
One place for everything
Notes, chapter practice, previous-year questions, test series and full-length papers — all feeding one picture of your preparation.
Honest progress
No vanity streaks. Progress here means chapters mastered and accuracy that held up on harder questions.
Unlock the whole course
Full notes and short notes, the complete question bank with worked solutions, mock tests, full-length papers, and an adaptive plan that rebuilds itself as you improve.
Graph Fundamentals, Trees and Connectivity Notes for GATE CS
Graph Fundamentals, Trees and Connectivity notes for GATE CS: 40 study cards covering concepts, formulas, shortcuts and exam traps, plus solved practice questions.
Chapter Roadmap: Graph Fundamentals, Trees and Connectivity
Chapter Journey
Graph Fundamentals & Connectivity
1. Spanning Tree Enumeration
Counting trees using Cayley’s Formula & Kirchhoff’s Theorem.
2. Weighted Spanning Trees
Optimizing tree weight with Kruskal’s & Prim’s Algorithms.
3. Connectivity & Planarity
Graph robustness, Euler’s Formula, and edge bounds.
4. Matchings & Distances
Pairing vertices, diameter, and graph powers.
Why start here? Counting structures builds the intuition needed to optimize them and analyze their resilience.
Hero Concept: What is a Spanning Tree?
The Spanning Tree
For a connected undirected graph G=(V,E) with ∣V∣=n, a Spanning TreeT is a subgraph that:
1.Includes all vertices: V(T)=V(G)
2.Is connected
3.Is acyclic (No loops)
Critical Property
∣ET∣=n−1
Why Enumerate? Knowing the number of spanning trees, denoted as τ(G), tells us how many unique ways we can connect all nodes without loops.
Worked Example: Kirchhoff on a Sparse Graph
Example: K4 minus one edge
Vertices {1,2,3,4}. All edges present except (3,4).
Degrees: deg(1)=3,deg(2)=3 deg(3)=2,deg(4)=2
Reduce:
Delete Row 4 & Col 4.
Laplacian Matrix L
L=3−1−1−1−13−1−1−1−120−1−102
Reduced Matrix L′
L′=3−1−1−13−1−1−12
Determinant Calculation
det(L′)=3(5)+1(−3)−1(4)=8
Answer: 8 trees
Kirchhoff’s Matrix Tree Theorem (General Case)
Kirchhoff’s Theorem
For any connected graph G, not just complete ones.
Step 1: Laplacian Matrix L
Lij=⎩⎨⎧deg(vi)−10if i=jif i=j and (vi,vj)∈Eotherwise
Step 2: Compute Cofactor
Delete any row i and column j (usually row 1 and col 1) to get minor M11.
Step 3: Determinant
τ(G)=det(M11)
*The value is the same regardless of which row/column is deleted.
Graph Fundamentals, Trees and Connectivity: Solved Questions with Step-by-Step Explanations (10 Problems)
Question 1 · Engineering MathematicsMCQ
Consider a connected simple graph with 10 vertices. If we partition its edges into a spanning tree and a set of extra edges, and the total number of edges is 15, how many edges are in the extra set?
A.
6
B.
5
C.
4
D.
9
Correct Answer:
A
Step-by-Step Solution
Insight: A spanning tree of an n-vertex graph always contains exactly n−1 edges.
Exam route: The spanning tree has 10−1=9 edges. The extra edges are the total minus the tree edges: 15−9=6.
Learning route:
Identify the total number of vertices n=10 and total edges E=15.
Recall that any spanning tree of a graph with n vertices must have exactly n−1 edges.
Calculate the number of edges in the spanning tree: 10−1=9.
The extra edges are those not in the spanning tree. Subtract the tree edges from the total: 15−9=6.
Answer: 6
Question 2 · Engineering MathematicsMCQ
Assertion (A): For a graph with 6 vertices, the reduced Laplacian matrix used in Kirchhoff's theorem is of size 5×5.
Reason (R): The original Laplacian matrix is of size 6×6, and the method requires deleting exactly one row and one column.
A.
Both A and R are true and R is the correct explanation of A
B.
Both A and R are true but R is NOT the correct explanation of A
C.
A is true but R is false
D.
A is false but R is true
Correct Answer:
A
Step-by-Step Solution
Insight: Kirchhoff's theorem requires reducing the n×n Laplacian to an (n−1)×(n−1) matrix by deleting one row and one column.
Exam route: For n=6, the original matrix is 6×6. Deleting one row and one column yields a 5×5 matrix. R correctly explains why A is true.
Learning route:
Recall the statement of Kirchhoff's Matrix Tree Theorem.
The theorem states that the number of spanning trees is the determinant of any cofactor of the Laplacian matrix L.
A cofactor is obtained by deleting exactly one row i and one column j (usually i=j=1).
For a graph with n=6 vertices, L is a 6×6 matrix.
Deleting one row and one column reduces the dimensions by 1, resulting in a 5×5 matrix.
Thus, both A and R are true, and R is the direct mathematical reason for A.
Answer: Both A and R are true and R is the correct explanation of A
Question 3 · Engineering MathematicsMCQ
Consider the following:
Assertion (A): A connected planar graph with 10 vertices and 15 edges has 7 faces.
Reason (R): Euler's formula for connected planar graphs states V−E+F=2.
A.
Both A and R are true, and R is the correct explanation of A
B.
Both A and R are true, but R is NOT the correct explanation of A
C.
A is true but R is false
D.
A is false but R is true
Correct Answer:
A
Step-by-Step Solution
Key idea: Use Euler's formula to verify the assertion.
Step 1: Euler's formula states V−E+F=2 for connected planar graphs. So Reason (R) is true.
Step 2: Given V=10, E=15, substitute into Euler's formula: 10−15+F=2.
Step 3: Solve for F: F=2−10+15=7.
Step 4: The assertion states F=7, which matches our calculation. So Assertion (A) is true.
Answer: Both A and R are true, and R is the correct explanation of A.
Question 4 · Engineering MathematicsNAT
A connected graph has 4 vertices. The Laplacian matrix is:
L=3−1−1−1−13−1−1−1−120−1−102
If deleting row 4 and column 4 gives determinant 8, what determinant is obtained by deleting row 1 and column 1?
Correct Answer:
8
Step-by-Step Solution
Key idea: Kirchhoff's Matrix Tree Theorem states that the number of spanning trees equals the determinant of any cofactor of the Laplacian matrix. All cofactors (obtained by deleting row i and column i for any i) give the same value.
Step 1: Recognize that the problem gives us det(L′)=8 when we delete row 4 and column 4.
Step 2: By Kirchhoff's theorem, deleting any row i and column i (for i=1,2,3,4) gives the same determinant, which equals the number of spanning trees.
Step 3: Therefore, deleting row 1 and column 1 also gives determinant 8.
Answer: 8
Question 5 · Engineering MathematicsMSQ
Consider the following assertion and reason:
Assertion (A): For a connected graph with 4 vertices, if the determinant of the reduced Laplacian matrix (obtained by deleting row 4 and column 4) is 8, then the determinant obtained by deleting row 1 and column 1 is also 8.
Reason (R): According to Kirchhoff's Matrix Tree Theorem, all cofactors of the Laplacian matrix (obtained by deleting row i and column i for any i) are equal.
Which of the following statements are CORRECT?
A.
Assertion (A) is TRUE
B.
Reason (R) is TRUE
C.
Reason (R) is the correct explanation of Assertion (A)
D.
Assertion (A) is FALSE
Correct Answer:
["A","B","C"]
Step-by-Step Solution
Key idea: This is an assertion-reason question testing Kirchhoff's Matrix Tree Theorem and the property that all cofactors of the Laplacian are equal.
Step 1: Analyze Assertion (A):
Kirchhoff's theorem states that the number of spanning trees equals the determinant of any cofactor of the Laplacian.
All cofactors (obtained by deleting row i and column i) give the same value.
If deleting row 4 and column 4 gives determinant 8, then deleting row 1 and column 1 also gives 8.
Therefore, (A) is TRUE.
Step 2: Analyze Reason (R):
This is a direct statement of Kirchhoff's theorem: all cofactors are equal.
Therefore, (R) is TRUE.
Step 3: Check if (R) explains (A):
(A) claims that two specific cofactors are equal.
(R) states that ALL cofactors are equal.
(R) directly explains why (A) is true.
Therefore, (R) IS the correct explanation of (A).
Step 4: Evaluate options:
(A) Assertion is TRUE: ✓
(B) Reason is TRUE: ✓
(C) Reason explains Assertion: ✓
(D) Assertion is FALSE: ✗
Answer: A, B, C
Question 6 · Engineering MathematicsMCQ
Consider a directed graph with 5 vertices labeled 1,2,3,4,5. A directed edge exists from vertex i to vertex j if and only if j<i.
Assertion (A): The number of directed spanning trees rooted at vertex 5 is 24.
Reason (R): In such a graph, every vertex except the root must choose exactly one incoming edge from a vertex with a higher index, and the number of choices for vertex k is 5−k.
Which of the following is correct?
A.
Both A and R are true, and R is the correct explanation of A
B.
Both A and R are true, but R is NOT the correct explanation of A
C.
A is true, but R is false
D.
A is false, but R is true
Correct Answer:
A
Step-by-Step Solution
Key idea: This is an assertion-reason question about directed spanning trees. We need to verify both statements and check if R explains A.
Step 1: Understand the graph structure.
Vertices: 1, 2, 3, 4, 5
Edge from i to j exists iff j<i
So edges point from higher to lower indices
Examples: 5→4,5→3,5→2,5→1,4→3,4→2,4→1,3→2,3→1,2→1
Step 2: Verify Assertion (A).
A directed spanning tree rooted at 5 requires directed paths from 5 to all other vertices
Since edges go from higher to lower, the root must be 5 (highest index)
Each vertex k∈{1,2,3,4} must have exactly one incoming edge in the tree
Vertex 4: can receive from {5} → 1 choice
Vertex 3: can receive from {4, 5} → 2 choices
Vertex 2: can receive from {3, 4, 5} → 3 choices
Vertex 1: can receive from {2, 3, 4, 5} → 4 choices
Total trees = 1×2×3×4=24
Assertion (A) is TRUE.
Step 3: Verify Reason (R).
R states: vertex k has 5−k choices
Check: vertex 4 has 5−4=1 choice ✓
Vertex 3 has 5−3=2 choices ✓
Vertex 2 has 5−2=3 choices ✓
Vertex 1 has 5−1=4 choices ✓
Reason (R) is TRUE.
Step 4: Check if R explains A.
R correctly describes why the count is 1×2×3×4=24
R is the correct explanation of A.
Answer: Both A and R are true, and R is the correct explanation of A.
Question 7 · Engineering MathematicsMCQ
The number of spanning trees in a complete graph with 5 labeled vertices is
A.
125
B.
625
C.
24
D.
120
Correct Answer:
A
Step-by-Step Solution
Insight: Direct application of Cayley's formula for complete graphs.
Exam route: The formula for the number of spanning trees in Kn is nn−2. For n=5, this is 55−2=53=125.
Learning route:
Identify the graph as a complete graph Kn with labeled vertices.
Recall Cayley's formula: τ(Kn)=nn−2.
Substitute n=5 into the formula: 55−2=53.
Calculate 53=125.
Answer: 125
Question 8 · Engineering MathematicsMCQ
Which of the following statements about the row sums of the Laplacian matrix L of a simple undirected graph is true?
A.
The sum of elements in any row is always 0
B.
The sum of elements in any row is equal to the degree of the corresponding vertex
C.
The sum of elements in any row is always 1
D.
The sum of elements in any row is equal to the number of vertices
Correct Answer:
A
Step-by-Step Solution
Insight: The diagonal entry of the Laplacian is the vertex degree, and the off-diagonal entries are -1 for each adjacent vertex.
Exam route: Row sum = deg(vi)+∑(−1)=deg(vi)−deg(vi)=0.
Learning route:
Recall the definition of the Laplacian matrix L: Lii=deg(vi) and Lij=−1 if (vi,vj)∈E, else $0$.
The sum of the elements in row i is the diagonal entry plus the sum of the off-diagonal entries.
There are exactly deg(vi) off-diagonal entries equal to −1 in row i.
Sum = deg(vi)+(−deg(vi))=0.
Answer: The sum of elements in any row is always 0
Question 9 · Engineering MathematicsMCQ
If the determinant of the reduced Laplacian matrix of a connected graph is 12, how many spanning trees does the graph have?
A.
6
B.
12
C.
24
D.
144
Correct Answer:
B
Step-by-Step Solution
Key idea: Kirchhoff's Matrix Tree Theorem states that the number of spanning trees equals the determinant of any cofactor of the Laplacian matrix.
Step 1: According to Kirchhoff's theorem, τ(G)=det(L′), where L′ is the reduced Laplacian matrix (obtained by deleting any one row and one column from the Laplacian).
Step 2: The problem states that det(L′)=12.
Step 3: Therefore, the number of spanning trees is τ(G)=12.
Answer: 12.
Question 10 · Engineering MathematicsMCQ
What is the maximum number of edges in a simple disconnected graph with 6 vertices?
A.
10
B.
15
C.
12
D.
9
Correct Answer:
A
Step-by-Step Solution
Key idea: To maximize edges in a disconnected graph, make one component as large as possible (Kn−1) and one isolated vertex (K1).