Graph Theory for GATE CS: Concepts and Worked Examples
Build graph theory from two fully specified examples. Work through degree counts, connectivity, spanning trees, bipartiteness, planarity, and Euler and Hamilton checks.
KnowledgeGate Team
Exam prep & CS education

Graph theory questions can look like a collection of unrelated terms: degree, path, tree, planar graph, colouring, Euler, and Hamilton. The difficulty reduces when the same small graph connects those ideas. Two small graphs are enough to settle all of them for GATE CS preparation: a six-vertex graph with seven edges, and a six-cycle carrying one chord. Every degree, bridge, spanning tree, colouring and face count comes straight off those two edge lists, so keep them beside you.
1. Graph basics: the language every solution needs
A graph is written as , where is its vertex set and is its edge set. Its order is , and its size is . Two vertices are adjacent when an edge joins them. A vertex and an edge are incident when that edge touches the vertex. The degree counts incident edge ends. A loop begins and ends at the same vertex, while parallel edges join the same pair more than once.
Our main graph is finite, simple, and undirected:
Thus and . Its edges are unordered pairs, with no loops or parallel edges. An edge list is compact for calculation, an adjacency list records each vertex's neighbours, and an adjacency matrix gives a square lookup table. Because has only seven edges, every claim about it can be settled by reading that list line by line.
2. Degree, edge count, and the complement of a graph
Read each degree directly from the seven edges:
touches , so .
touches , so .
touches , so .
touches , so .
touches , so .
touches only , so .
The degree sum is
This verifies the handshaking lemma. The odd-degree vertices are , four in total, which is correctly an even number.
A simple undirected graph on six labelled vertices can contain at most
edges. The complement therefore has edges. At , the complement-degree rule gives . Indeed, is not adjacent to in , so those are exactly its three complement neighbours.

3. Walks, trails, paths, cycles, and connectivity
A walk is any sequence of vertices in which each consecutive pair is joined by an edge, and both vertices and edges may repeat. So is a walk in , even though it reuses edge and revisits and . Trails, paths and cycles are walks with restrictions added.
Check each sequence against repeated edges first, then repeated vertices. uses the edges once each, so it is a trail. It is not a path because vertex repeats. By contrast, is a path because every vertex, and therefore every used edge, is distinct. The sequence returns to its starting vertex without repeating another vertex, so it is a cycle.
The graph is connected, but some single removals can disconnect it. Removing isolates , so is a bridge. Removing vertex , together with its incident edges, also isolates , so is an articulation vertex. However, is not a bridge. If it is removed, can still reach along . Connectivity must be checked using an alternative route, not by judging how important an edge looks in a drawing.
4. Trees and spanning trees from a connected graph
A tree is connected and acyclic. A tree with vertices has edges, and every pair of its vertices has one unique simple path between them. The edge count alone is not sufficient: a disconnected graph with a cycle can also have edges. Pair the count with connectivity or acyclicity.
For , take
This subgraph contains all six vertices, has five edges, and is connected. It is therefore a spanning tree. The omitted edges are and . Each would close a cycle if restored, so removing them preserves connectivity while eliminating cycles. Edge cannot be omitted from any spanning tree of , because it is the only edge incident on and is already a bridge.
5. Bipartiteness, colouring, and planar faces
Now define a second graph by
It is a six-cycle with chord . Use the partition
Every listed edge has one endpoint in and one in , including the chord . Hence is bipartite. Colour all vertices in blue and all vertices in orange to get a proper two-colouring. Its chromatic number is exactly : two colours suffice, and one cannot suffice because the graph has edges.
In the planar embedding drawn below, , , and , where the faces are the two bounded regions and the outer face. Euler's planar formula checks the count:
This formula concerns vertices, edges, and faces in a connected planar embedding. It is different from an Euler trail or Euler circuit, which asks for a traversal using every edge exactly once.

6. How GATE CS questions combine graph theory concepts
A problem may ask you to reconstruct an edge count from degrees, decide whether a degree sequence is graphical, identify a bridge or articulation vertex, choose a spanning tree, or test bipartiteness and planarity. Another common reasoning split is between Euler conditions and Hamilton conditions. Treat each as a request for a specific property, then apply only the relevant test.
For , the four odd-degree vertices mean that the connected graph has neither an Euler circuit nor an Euler trail. A circuit requires zero odd-degree vertices, while a trail requires exactly two. The leaf rules out a Hamiltonian cycle, because a vertex on such a cycle needs two cycle edges. One Hamiltonian path does exist, however:
The edges are all in , and the sequence visits every vertex exactly once. For the same concepts pushed further, read Graph Theory: Euler and Hamiltonian Paths, Coloring and Connectivity. For the same ideas in question form, work through Graph MCQs: 10 solved questions on representations, BFS, DFS and connectivity.
7. Graph theory traps that cost correct answers
First identify the graph type. A loop contributes two to the degree of its vertex, not one, and formulas for simple graphs may fail on a multigraph. Next, keep walk, trail, and path separate: check repeated edges for a trail, then repeated vertices for a path.
Do not transfer Euler's degree criterion to Hamilton questions. Write two prompts on the page: “uses every edge” for Euler, and “visits every vertex” for Hamilton. Similarly, do not declare a graph a tree merely because it has edges. Verify that it is connected and acyclic. For Euler's planar formula, count every face, including the unbounded outer face. These short checks prevent a correct calculation from being attached to the wrong definition.
8. Graph theory recall chain and your next practice step
Use this recall chain: identify the graph type, write and , compute degrees and , inspect cycles and cuts, then test the required tree, bipartite, or planar condition. Finally, separate edge-covering Euler questions from vertex-covering Hamilton questions.
If you need full subject sequencing, continue with GATE Guidance by Sanchit Sir. If you have revised the concepts and want timed practice, use the GATE Test Series. KnowledgeGate's practice bank also holds more than 350 graph theory questions, so your next step can be simple: revise one condition, solve a set, and explain every rejected option.
Keep learning

Classification of Finite and Infinite Groups: Orders, Cyclicity and Worked Examples
Learn how group axioms, group order, element order and generators classify finite and infinite groups through complete, checkable examples.

Bipartite, Cycle, Regular and Complement Graphs: Tests, Formulas and a C6 Worked Example
Learn a dependable order for classifying simple graphs, then apply it to C6 and list, count and test every edge in its complement.

Basic Terminologies in Linear Programming: Feasible Solutions, BFS and an Optimal Solution Worked Step by Step
Separate feasible, basic feasible and optimal solutions through geometry, slack variables, vertex enumeration and concise counterexamples.

Assignment Problem and Hungarian Method: Formulation with a Complete Worked Example
Learn why greedy assignment fails, how matrix reductions preserve the optimum, and how the uncovered-value adjustment leads to a minimum cost of 140.