Introduction
Imagine you are looking at a giant map of the entire United States highway system — hundreds of cities, thousands of roads, overwhelming complexity. Now imagine you cut out just your home state and study its roads in isolation. You have created a subgraph.
Subgraphs are the fundamental tool for zooming in on a graph. Almost every advanced graph theory result — connectivity, coloring, spanning trees, cliques — is stated in terms of what subgraphs a graph contains or avoids. Understanding them precisely is essential for everything that follows.
Definition
Formal Definition
Definition: A graph is a subgraph of a graph , written , if:
- Every vertex of is also a vertex of :
- Every edge of is also an edge of :
In other words: is obtained from by keeping some vertices and some edges — and discarding the rest.
The Golden Rule
The Golden Rule of Subgraphs: If an edge is included in , then both of its endpoints must also be in .
It is mathematically impossible to include an edge without its two endpoints. An edge floating with a missing endpoint is not a graph at all.
The Parent Graph
Every subgraph example in this post is drawn from the same parent graph :
has 6 vertices (–) and 8 edges. The two rows form a natural structure: top row and bottom row with cross-connections.
A Valid Subgraph
To create a subgraph, choose any subset of vertices, then choose any subset of the edges that connect only those vertices.
Here uses vertices and edges (shown orange). The remaining vertices (faded) and the remaining edges (dashed) are in but not in . Every orange edge connects two orange vertices — the Golden Rule is satisfied.
Checklist to verify a subgraph:
| Check | Question | above |
|---|---|---|
| Vertex subset | Is ? | ✓ |
| Edge subset | Is ? | ✓ |
| Golden Rule | Does every edge have both endpoints in ? | all present ✓ |
What Makes a Subgraph Invalid?
This attempt includes edge but vertex is not in the vertex set (shown faded red). The edge has a missing endpoint — this violates the Golden Rule and is not a valid subgraph.
Induced Subgraphs
Sometimes you want a subgraph that gives the complete picture of the relationships among a chosen set of vertices — no cherry-picking which edges to include or exclude.
Definition
Definition: The induced subgraph for a vertex set is the subgraph that contains all vertices in and every edge of whose both endpoints are in .
You choose the vertices; the edges are forced — you must include all of them. You cannot add or remove any edge from an induced subgraph.
The Social Network Example
Consider a complete social network of 4 people where everyone knows everyone ():
Six friendships in total (every pair of 4 people). Now we want to study the sub-group Alice, Bob, Charlie.
Option 1 — Regular (non-induced) subgraph:
We pick vertices Alice, Bob, Charlie — but we decide to only include the Alice–Bob edge. This is a valid subgraph, but it hides information: Charlie knows both Alice and Bob, yet he appears isolated. The dashed edges show the friendships we deliberately omitted.
Option 2 — Induced subgraph Alice, Bob, Charlie:
The induced subgraph forces all edges between the chosen vertices. Alice–Bob, Bob–Charlie, and Alice–Charlie are all included automatically. The result is (a triangle) — the true and complete picture of how these three people relate.
Why Induced Subgraphs Matter
Induced subgraphs preserve the full local structure. When graph theorists say “this graph contains a triangle” they mean “this graph has an induced subgraph isomorphic to .” The induced subgraph is the honest representation of a vertex set’s internal relationships.
Graph Surgery: Removing Vertices and Edges
A practical way to build subgraphs is by deleting things from .
Edge Deletion:
Definition: is the graph obtained by removing edge from , keeping all vertices.
The vertices at both ends of the deleted edge remain. Only the connection between them disappears.
: edge (shown in red, dashed) is removed. Both and stay as vertices — they are just no longer directly connected. All other edges and vertices are unchanged.
Notation for removing a set of edges: where .
Vertex Deletion:
Definition: is the graph obtained by removing vertex from and all edges incident to .
When a vertex is deleted, every edge touching it must also go — you cannot leave edges without their endpoints.
: vertex (faded red) is removed along with its three incident edges , , (red dashed). The remaining graph on vertices keeps only edges that do not touch .
Warning: Deleting a single vertex can shatter a connected graph. If were a cut vertex (Post 10), removing it would create two or more disconnected components.
Notation for removing a set of vertices: where . This removes all vertices in and all edges with at least one endpoint in .
The Subgraph Relationship
Both and produce subgraphs of :
- is a spanning subgraph (all vertices kept, one edge removed)
- is a subgraph on vertices
Spanning Subgraphs
A special class of subgraphs worth naming:
Definition: A spanning subgraph of is a subgraph that contains all vertices of (it “spans” ) but possibly fewer edges.
The spanning trees from Post 13 are exactly the spanning subgraphs that are also trees — connected and acyclic, with edges.
Relationship hierarchy:
A spanning subgraph keeps all vertices but may drop edges. An induced subgraph keeps all edges between chosen vertices but may drop vertices. These two directions are complementary ways of extracting structure from .
Special Subgraphs That Matter
When graph theorists study massive networks, they hunt for specific subgraph patterns that reveal deep structure.
Paths and Cycles as Subgraphs
When we say “graph contains a path from to ,” we mean has a path subgraph connecting to . Similarly “ contains a cycle” means has a cycle as a subgraph.
This language appears constantly: “ contains as a subgraph” means there are 5 vertices in that form a 5-cycle using edges that exist in .
Cliques — The Complete Subgraph
Definition: A clique is a subset of vertices such that every pair of vertices in is adjacent — i.e., the induced subgraph is a complete graph .
- A 3-clique is a triangle ()
- A 4-clique is — four mutually adjacent vertices
- The clique number is the size of the largest clique in
Social network analogy: A clique is a tight-knit group where literally everyone knows everyone else — no stranger in the group.
The green vertices form a 4-clique: all 6 edges between them exist (green). The purple vertices are connected to the clique but are not part of it. Finding this subgraph is finding the clique.
Connection to graph coloring (Post 12): The clique number gives a lower bound on the chromatic number: . A 4-clique forces at least 4 colors.
Independent Sets — The Stranger Group
Definition: An independent set is a subset of vertices such that no two vertices in are adjacent — i.e., the induced subgraph has no edges.
- The independence number is the size of the largest independent set in
Social network analogy: A group of people at a party who are all complete strangers — nobody in the group knows anyone else in the group.
The orange vertices form an independent set — no orange–orange edge exists. Every blue vertex is adjacent to at least one orange vertex. The dashed edges show boundaries near the set.
Connection to graph coloring: Every color class in a proper coloring is an independent set. When you color a graph with colors, you partition its vertices into independent sets.
The fundamental identity:
This is König’s theorem for bipartite graphs, and the general relation is Gallai’s theorem.
The Subgraph Relationships Summary
G (full graph)
├── Spanning subgraph: keep all V, drop some E
│ └── Spanning tree: spanning subgraph that is a tree (|E| = |V|-1)
│
├── Induced subgraph G[S]: keep subset S of V, keep ALL edges within S
│ └── G[S] = K_k → S is a clique
│ └── G[S] = empty → S is an independent set
│
└── General subgraph: any subset of V and subset of E (Golden Rule applies)
└── G - e: subgraph with one edge removed
└── G - v: subgraph with one vertex (and its edges) removed
Practice Problems
Problem 1: Is it a Valid Subgraph?
Question: Graph has vertices and edges . Is with vertices and edges a valid subgraph of ?
Click to reveal solution
Check the Golden Rule on each edge of $H$:
- Edge 12: both vertices 1 and 2 are in $V(H)$ ✓
- Edge 13: both vertices 1 and 3 are in $V(H)$ ✓
- Edge 35: vertex 5 is NOT in $V(H) = \{1,2,3\}$ ✗
No — $H$ is not a valid subgraph. Edge 35 has endpoint 5 which is not in the vertex set of $H$. This violates the Golden Rule.
Problem 2: Induced Subgraph
Question: Graph has vertices and edges . What is the induced subgraph ?
Click to reveal solution
The induced subgraph $G[\{A,B,C\}]$ contains:
- Vertices: $\{A,B,C\}$
- Edges: all edges of $G$ with both endpoints in $\{A,B,C\}$
Checking each edge: AB (both in set ✓), AC (both in set ✓), BC (both in set ✓), CD (D not in set ✗).
$G[\{A,B,C\}]$ has vertices $\{A,B,C\}$ and edges $\{AB, AC, BC\}$ — a triangle $K_3$.
Problem 3: Edge vs Vertex Deletion
Question: Graph has vertices and edges .
(a) What is ?
(b) What is ?
Click to reveal solution
(a) $G - 13$: Remove edge 13 only. Vertices unchanged.
- Vertices: $\{1,2,3,4\}$
- Edges: $\{12,23,34\}$
(b) $G - 3$: Remove vertex 3 and all incident edges (13, 23, 34).
- Vertices: $\{1,2,4\}$
- Edges: $\{12\}$ (only edge not touching vertex 3)
Note: vertex 4 becomes isolated after removing vertex 3.
Problem 4: Identifying a Clique
Question: A graph has vertices and edges . What is the largest clique? What is ?
Click to reveal solution
Check $\{A,B,C,D\}$: need all 6 pairs. Present: AB ✓, AC ✓, AD ✓, BC ✓, BD ✓, CD ✓. All 6 edges exist!
$\{A,B,C,D\}$ is a 4-clique ($K_4$).
Can we extend to 5? Add E: need AE, BE, CE, DE all present. AE ✗ not in edge list. Cannot extend.
$\omega(G) = 4$. The largest clique is $\{A,B,C,D\}$.
Problem 5: Independent Set and Coloring
Question: If a graph has an independent set of size 4, what does that tell you about graph coloring?
Click to reveal solution
An independent set is a set of vertices with no edges between them — every proper coloring can assign all of them the same color.
A maximum independent set of size 4 means we can "save" 4 vertices in a single color class.
Formally: $\alpha(G) \geq 4$ tells us that we can always use one color for at least 4 vertices in any valid coloring. But it does not directly give the chromatic number — we'd need to know the full structure.
Key link: every color class in a proper $k$-coloring is an independent set. Graph coloring = partitioning $V$ into independent sets.
Problem 6: Spanning Subgraph
Question: A connected graph has 7 vertices and 10 edges. How many edges does a spanning tree of have? Is a spanning tree a subgraph of ?
Click to reveal solution
A spanning tree on $n$ vertices has $n - 1$ edges. With $n = 7$: spanning tree has $7 - 1 = 6$ edges.
A spanning tree is a spanning subgraph of $G$ — it contains all 7 vertices and 6 of the 10 edges (chosen to be acyclic and connected).
Yes, a spanning tree is a subgraph of $G$ (specifically a spanning subgraph). It has 6 edges.
Summary Table
| Type | Vertices | Edges | Key constraint |
|---|---|---|---|
| Subgraph | Subset of | Subset of | Every edge’s endpoints must be in |
| Induced subgraph | Chosen set | ALL edges of within | No cherry-picking — all interior edges forced |
| Spanning subgraph | ALL of | Subset of | All vertices retained; edges optional |
| Spanning tree | ALL of | edges from | Connected + acyclic spanning subgraph |
| Clique (as induced subgraph) | Set | All edges | — complete |
| Independent set (as induced subgraph) | Set | Zero edges | has no edges at all |
Edge operations:
| Operation | Notation | What changes |
|---|---|---|
| Remove edge | Edge gone; both endpoints remain | |
| Remove vertex | Vertex gone; all incident edges removed | |
| Remove edge set | All edges in removed; all vertices remain | |
| Remove vertex set | All vertices in removed; all their incident edges removed |
Real-World Applications
Social Network Analysis
Real social networks (Facebook, LinkedIn) are graphs with millions of vertices. Finding cliques identifies tight-knit communities. Finding large independent sets identifies groups that never interact. Both operations are computed on subgraphs of the massive network.
Subgraph Isomorphism in Drug Discovery
A drug molecule is a graph (atoms = vertices, bonds = edges). To check if a molecule contains a known “toxic substructure,” chemists look for subgraph isomorphism — does the molecule’s graph contain a copy of the dangerous pattern as a subgraph? This is one of the most computationally important subgraph problems in bioinformatics.
Compiler Register Allocation (Revisited)
In Post 12 we noted that register allocation uses graph coloring. The independent sets in the interference graph are exactly the sets of variables that can share a register — each color class is an independent set.
Network Resilience
Removing a vertex or edge (, ) models failure in infrastructure networks. Engineers study which vertex deletions disconnect the graph (cut vertices from Post 10) by analysing the resulting subgraph. A graph is -connected (Post 10) precisely when no set of vertices can disconnect it — a statement about which vertex deletions produce connected subgraphs.
The Maximum Clique and Maximum Independent Set Problems
Theorem: Finding the maximum clique () and the maximum independent set () are both NP-complete for general graphs.
For real-world graphs with thousands of vertices, these problems can take supercomputers years. However:
- For perfect graphs (which include bipartite graphs, chordal graphs, interval graphs) both problems can be solved in polynomial time
- For planar graphs, a -approximation exists
- In practice, branch-and-bound algorithms solve moderate instances (a few hundred vertices) quickly
Key Takeaways
- A subgraph uses a subset of ’s vertices and a subset of ’s edges. The Golden Rule: every edge in must have both endpoints in .
- An induced subgraph is the “honest” subgraph on vertex set — all edges between vertices of are automatically included; none can be omitted.
- A spanning subgraph keeps all vertices of but may drop edges. Spanning trees are the minimally-connected spanning subgraphs.
- Edge deletion removes an edge but keeps all vertices. Vertex deletion removes a vertex and all its incident edges.
- A clique is a complete subgraph: every pair of vertices in the clique is adjacent. The clique number is the size of the largest clique; it lower-bounds the chromatic number: .
- An independent set is a subgraph with no edges: no two vertices in the set are adjacent. Every color class in a proper coloring is an independent set.
- Finding maximum cliques and maximum independent sets is NP-complete in general — among the hardest computational problems known.
Explore Further
Use the GraphArena Playground to experiment:
- Build the parent graph with 6 vertices and draw a subgraph by selecting 4 of the vertices — check the Golden Rule for each edge you include.
- Build and construct the induced subgraph on 3 vertices — verify all 3 edges are forced.
- Build any connected graph with 5 vertices, then delete a vertex. Does the resulting graph stay connected? Try deleting different vertices.
- Build a 6-vertex graph and try to find its maximum clique manually. Then find a maximum independent set — notice that the two sets are often complementary in structure.
- Color your graph from the independent set exercise: do the color classes match the independent sets you found?
Subgraphs are the microscope of graph theory — they let you isolate exactly the structure you care about and study it without distraction from the rest of the network.