Discrete StructureUnit 78 min read
Graph Representations & Isomorphism: Matrices, Lists, and Structural Equivalence
Unit 7 of Discrete Structure covers graph representations (adjacency matrices, lists, incidence matrices) and isomorphism criteria, including vertex/edge matching, degree sequences, and connectivity tests—essential for analyzing structural equivalence in graphs.
1. Graph Representations
Graphs can be represented in multiple ways, each with distinct advantages for computation, storage, and analysis.
1.1 Adjacency Matrix
Definition: A square matrix of size (for vertices) where:
- if there is an edge from vertex to ,
- otherwise.
For weighted graphs, stores the edge weight.
How it works
- Undirected graph: Symmetric matrix ().
- Directed graph: Asymmetric matrix.
- Self-loops: (or weight if weighted).
Example
Consider an undirected graph with vertices and edges :
A B C
A [0,1,0]
B [1,0,1]
C [0,1,0]
Advantages & Disadvantages
| Advantages | Disadvantages |
|---|---|
| Easy to implement matrix operations | Space-inefficient for sparse graphs () |
| Fast to check if an edge exists | Slow for large graphs (dense storage) |
Applications
- Used in pathfinding algorithms (e.g., Floyd-Warshall).
- Graph multiplication for transitive closure.
1.2 Adjacency List
Definition: A list of linked lists (or arrays) where each vertex has a list of adjacent vertices.
How it works
- For each vertex, store its neighbors.
- Undirected graph: Each edge appears twice (once for each direction).
- Directed graph: Only store outgoing edges.
Example
For the same graph with edges :
A → [B]
B → [A, C]
C → [B]
Advantages & Disadvantages
| Advantages | Disadvantages |
|---|---|
| Space-efficient for sparse graphs () | Slower edge existence checks ( per vertex) |
| Faster traversal (BFS/DFS) | No direct matrix operations possible |
Applications
- Breadth-First Search (BFS) and Depth-First Search (DFS).
- Kruskal’s/Prim’s algorithms for MST.
1.3 Incidence Matrix
Definition: A matrix of size (for edges and vertices) where:
- if edge is incident to vertex ,
- otherwise.
Example
For edges :
A B C
e1 [1,1,0]
e2 [0,1,1]
Advantages & Disadvantages
| Advantages | Disadvantages |
|---|---|
| Useful for edge-based operations | Less intuitive for vertex operations |
| Helps in graph decomposition | Not commonly used in algorithms |
Applications
- Network flow problems.
- Bipartite graph matching.
1.4 Comparison Table
| Representation | Space Complexity | Edge Check | Traversal Speed | Best For |
|---|---|---|---|---|
| Adjacency Matrix | Dense graphs, matrix ops | |||
| Adjacency List | Sparse graphs, traversal | |||
| Incidence Matrix | Edge-focused problems |
2. Graph Isomorphism
Two graphs and are isomorphic if there exists a bijection (one-to-one correspondence) between their vertex sets that preserves adjacency.
2.1 Necessary Conditions for Isomorphism
Before checking isomorphism, verify these necessary (but not sufficient) conditions:
- Same number of vertices and edges.
- Same degree sequence (multiset of vertex degrees).
- Same connectivity (both connected/disconnected similarly).
- Same number of cycles of each length.
Example
- Graph : Vertices , edges .
- Graph : Vertices , edges .
- Isomorphic because degree sequences match ().
2.2 Checking Isomorphism
- Relabel vertices to match degree sequences.
- Compare adjacency:
- If two vertices are adjacent in , their images must be adjacent in .
- Use backtracking for small graphs.
Algorithm Steps
- Sort vertices by degree.
- Try all possible mappings of vertices.
- Verify adjacency preservation.
Example (Non-Isomorphic Graphs)
- : with edges (star graph).
- : with edges (path graph).
- Not isomorphic because degree sequences differ ( vs. ).
2.3 Applications of Isomorphism
- Chemistry: Molecule structure comparison.
- Computer Vision: Shape recognition.
- Database Theory: Schema matching.
- Cryptography: Pattern recognition in graphs.
3. Worked Examples
Example 1: Adjacency Matrix Conversion
Graph: Vertices , edges . Adjacency Matrix:
P Q R
P [0,1,0]
Q [1,0,1]
R [0,1,0]
Example 2: Isomorphism Check
Graph : , edges (star). Graph : , edges (star). Conclusion: Isomorphic (same degree sequence ).
Example 3: Non-Isomorphic Graphs
Graph : , edges (triangle). Graph : , edges (path). Conclusion: Not isomorphic (different degree sequences vs. ).
4. Common Mistakes & Clarifications
Adjacency Matrix for Directed Graphs:
- means edge from to .
- For undirected graphs, the matrix is symmetric.
Degree Sequence Mismatch:
- If two graphs have different degree sequences, they cannot be isomorphic.
Connectivity Matters:
- Two disconnected graphs with the same degree sequence may not be isomorphic if their components differ.
Isomorphism ≠ Homeomorphism:
- Isomorphism preserves adjacency; homeomorphism allows edge subdivisions.
Exam Tip
What to Expect in TU Exams
Graph Representation Questions (3-5 marks):
- Convert a given graph to adjacency matrix/list.
- Identify sparse vs. dense graphs and choose the best representation.
- Example: "Represent the following graph using an adjacency list."
Isomorphism Problems (5-7 marks):
- Step 1: Check necessary conditions (degree sequence, edge count).
- Step 2: Attempt a vertex mapping and verify adjacency.
- Step 3: If stuck, argue why they are not isomorphic based on conditions.
- Example: "Prove whether the following two graphs are isomorphic."
Short Answer Questions (2 marks each):
- Define adjacency matrix, incidence matrix, or graph isomorphism.
- State necessary conditions for isomorphism.
- Example: "List two necessary conditions for two graphs to be isomorphic."
Applications (2-3 marks):
- Explain where adjacency lists are preferred over matrices.
- Give an example of graph isomorphism in real life (e.g., chemistry).
How to Score Full Marks
- For representations:
- Clearly label rows/columns in matrices.
- List vertices in consistent order (alphabetical/numerical).
- For isomorphism:
- Always check degree sequences first (quick elimination).
- If isomorphic, explicitly state the mapping (e.g., ).
- If not, provide a counterexample (e.g., "Vertex A has degree 3 in but no vertex in has degree 3").
- Use diagrams if allowed (even simple sketches help).
Past Exam Patterns
- 2078: Adjacency matrix conversion + isomorphism proof.
- 2079: Compare adjacency list vs. matrix for a given graph.
- 2080: Necessary conditions for isomorphism + example.
Based on the TU BSc CSIT syllabus for Discrete Structure (CSC165), unit 7.
Discussion
Loading…