Discrete StructureUnit 610 min read
Graph Theory Basics: Definitions, Paths, Trees, and Isomorphism
Unit 6 of Discrete Structure covers foundational graph theory concepts—vertices, edges, degrees, Eulerian paths/circuits, Hamiltonian cycles, trees, isomorphism, and basic graph representations—with definitions, theorems, and practical applications like network flows and scheduling.
Core Definitions and Terminology
Graph Basics
A graph is a pair , where:
- = finite set of vertices (nodes).
- = set of edges connecting pairs of vertices.
- Undirected edge: (no direction).
- Directed edge (arc): (from to ).
- Weighted graph: Edges have numerical values (e.g., distances).
Degree of a vertex:
- Undirected: number of edges incident to .
- Directed: (out-degree), (in-degree).
Key Theorems:
- Handshaking Lemma: Sum of all vertex degrees = (undirected). Proof: Each edge contributes 2 to the total degree sum.
- Isolated vertex: .
- Path: Sequence of vertices where each .
- Cycle: Path where and no repeated vertices/edges (except start/end).
Eulerian and Hamiltonian Graphs
Eulerian Graphs
- Eulerian Path: Traverses every edge exactly once (no repeats).
- Eulerian Circuit: Eulerian Path that starts/ends at the same vertex.
Conditions:
Graph Type Necessary & Sufficient Conditions Example Eulerian Circuit All vertices have even degree, and graph is connected. Cycle graph . Eulerian Path Exactly 0 or 2 vertices have odd degree, rest even. "A" shape (2 odd-degree vertices).
Algorithm to Find Eulerian Circuit (Fleury’s):
- Start at any vertex with .
- Traverse edges, removing them as you go.
- At each step, avoid bridges (edges whose removal disconnects the graph) unless no choice.
- Stop when all edges are traversed.
Hamiltonian Graphs
- Hamiltonian Cycle: Path that visits every vertex exactly once and returns to the start.
- No simple degree-based conditions exist (NP-Hard to verify). Examples:
- Complete graph : Always Hamiltonian.
- Cycle graph : Hamiltonian if .
- Bipartite graphs: Only Hamiltonian if parts have equal size (e.g., is not).
Trees and Spanning Trees
Tree Definitions
- Tree: Connected acyclic graph.
- Properties:
- vertices → edges.
- Any two vertices have exactly one path between them.
- Adding any edge creates a cycle.
- Properties:
- Forest: Disjoint union of trees.
- Rooted Tree: Tree with a designated root vertex (used in hierarchies).
Spanning Trees
- Spanning Tree: Subgraph of that is a tree and includes all vertices of .
- Minimum Spanning Tree (MST): Spanning tree with the minimum total edge weight.
Algorithms:
- Kruskal’s:
- Sort edges by weight (ascending).
- Add edges one by one, skipping those that form cycles (use Union-Find).
- Prim’s:
- Start from any vertex, grow the tree by adding the cheapest edge to the current tree.
- Kruskal’s:
Example (Kruskal’s): Given graph with edges :
- Sort: , , , , .
- Add , , . MST edges: , total weight = 6.
Graph Isomorphism
Two graphs and are isomorphic if there exists a bijection such that:
- (undirected).
- (directed).
Conditions to Check:
- Same number of vertices/edges.
- Same degree sequence (multiset of degrees).
- Same connectivity (e.g., both connected/disconnected).
- Same number of cycles of each length.
Example:
- : Vertices , edges .
- : Vertices , edges . Isomorphic via .
Non-Isomorphic Example:
- (complete graph on 3 vertices) vs. (cycle on 3 vertices).
- Both have 3 vertices/edges, but has all pairs connected; is a single cycle.
Graph Representations
| Method | Description | Example (Graph with edges ) |
|---|---|---|
| Adjacency Matrix | matrix where if edge exists. | |
| Adjacency List | List of edges/neighbors for each vertex. | , , |
| Incidence Matrix | matrix; row = vertex, column = edge, if incident. |
Advantages/Disadvantages:
| Method | Pros | Cons |
|---|---|---|
| Adjacency Matrix | Fast to check if edge exists (). | Space-inefficient for sparse graphs. |
| Adjacency List | Space-efficient for sparse graphs. | Edge existence check is . |
Applications of Graph Theory
- Network Routing: MST for efficient data transmission (e.g., internet topology).
- Scheduling: Project management (e.g., PERT charts use directed acyclic graphs).
- Social Networks: Friend recommendations (bipartite graphs: users vs. interests).
- Biology: Protein interaction networks (vertices = proteins, edges = interactions).
- Transportation: Shortest path algorithms (Dijkstra’s) for GPS navigation.
- Bipartite Matching: Assigning tasks to workers (e.g., stable marriage problem).
Worked Examples
Example 1: Eulerian Path/Circuit
Question: Does the following graph have an Eulerian circuit or path?
A -- B -- C
| | |
D -- E -- F
Solution:
- Degrees: .
- Odd-degree vertices: (only one).
- Conclusion: No Eulerian circuit (needs 0 odd vertices) or path (needs 0 or 2 odd vertices). Correction: If we add edge , degrees become . Now 2 odd vertices () → Eulerian path exists.
Example 2: Spanning Tree (Prim’s Algorithm)
Graph:
A -- B (weight 1)
| |
3 2
| |
D -- C (weight 4)
Steps:
- Start at . Add (weight 1).
- From , cheapest edge is (weight 2).
- From , cheapest is (weight 3). MST: , total weight = 6.
Example 3: Graph Isomorphism
Graphs:
- : Vertices , edges .
- : Vertices , edges . Solution: Isomorphic via . Both are paths of length 2.
Common Mistakes and Clarifications
Eulerian vs. Hamiltonian:
- Eulerian focuses on edges; Hamiltonian on vertices.
- Example: (complete graph on 4 vertices) is Hamiltonian but not Eulerian (unless all degrees are even, which they are, but it’s not a single cycle unless you repeat vertices).
Spanning Tree vs. Minimum Spanning Tree:
- All spanning trees connect all vertices, but MST minimizes total edge weight.
- Kruskal’s vs. Prim’s: Kruskal’s is edge-driven; Prim’s is vertex-driven.
Isomorphism:
- Not just about degree sequences (e.g., two graphs can have the same degree sequence but different structures, like vs. ).
- Always verify connectivity and cycle structure.
Adjacency Matrix for Directed Graphs:
- For , set , but unless there’s a reverse edge.
Exam Tip
What to Focus On
Definitions:
- Memorize Eulerian/Hamiltonian conditions and tree properties (e.g., vertices → edges).
- Know isomorphism criteria (degree sequence is necessary but not sufficient).
Algorithms:
- Kruskal’s/Prim’s: Practice on small graphs (3–5 vertices). Show steps clearly.
- Eulerian Circuit: Use Fleury’s algorithm; highlight bridges.
Proofs:
- Handshaking Lemma: Prove by counting edge contributions.
- Tree properties: Use induction (e.g., "A tree with vertices has edges"). Base case: (0 edges). Inductive step: Adding a leaf increases edges by 1.
Applications:
- Link graph theory to real-world problems (e.g., "Why use MST in network design?").
- For bipartite graphs, recall König’s theorem (matching = vertex cover).
Common Exam Questions:
- Given a graph, determine if it’s Eulerian/Hamiltonian.
- Find MST using Kruskal’s/Prim’s (show all steps).
- Prove isomorphism between two graphs (provide bijection).
- Shortest path: Use Dijkstra’s (if weights are non-negative).
Avoid These Pitfalls
- Assuming all graphs are Eulerian/Hamiltonian: Always check conditions.
- Forgetting directed graphs: Conditions differ (e.g., Eulerian directed graphs need in-degree = out-degree for all vertices).
- Incorrect MST: Skipping Union-Find in Kruskal’s leads to cycles.
- Isomorphism without verification: Degree sequence match ≠ isomorphism.
Sample Short-Answer Tips
- Define Eulerian Path: "A path that traverses every edge exactly once."
- MST Definition: "A spanning tree with the minimum possible total edge weight."
- Isomorphism: "Two graphs are isomorphic if there’s a one-to-one correspondence between vertices that preserves adjacency."
Long-Answer Strategy
- State definitions clearly.
- Draw the graph (if given) and label key parts.
- Apply theorems/algorithms step-by-step (e.g., Kruskal’s: sort → add → check cycles).
- Justify conclusions (e.g., "Since there are 4 odd-degree vertices, no Eulerian path exists").
Practice Problems
- Given a graph, find all Eulerian circuits (if any).
- Prove that a graph with 10 vertices and 11 edges is not a tree.
- Find MST for a given weighted graph using both Kruskal’s and Prim’s.
- Determine isomorphism between two graphs and provide the mapping.
- Apply graph coloring to a map to show 4 colors suffice (Four Color Theorem intuition).
Based on the TU BSc CSIT syllabus for Discrete Structure (CSC165), unit 6.
Discussion
Loading…