You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
This lesson covers how to represent graphs as matrices and how to determine when two graphs are structurally identical (isomorphic). Matrix representations allow graphs to be processed by computers and provide a way to calculate path counts.
For a graph with n vertices, the adjacency matrix is an n×n matrix A where:
Aij={10if there is an edge between vertices i and jotherwise
| Property | Detail |
|---|---|
| Symmetric | For undirected graphs, Aij=Aji |
| Diagonal | Aii=0 for simple graphs (no loops) |
| Row/column sum | Equals the degree of the vertex |
Consider a graph with vertices A, B, C, D and edges AB, AC, BC, CD.
A=0110101011010010
Row sums: A = 2, B = 2, C = 3, D = 1. These are the vertex degrees.
The entry (Ak)ij gives the number of walks of length k from vertex i to vertex j.
Using the matrix above:
A2=2111121111301101
(A2)AD=1: there is exactly 1 walk of length 2 from A to D (A-C-D).
(A2)CC=3: there are 3 walks of length 2 from C back to C (C-A-C, C-B-C, C-D-C).
Exam Tip: The diagonal entries of A2 give the degree of each vertex (the number of walks of length 2 from a vertex back to itself equals its degree). This provides a useful check.
For a weighted graph, the distance matrix records the weight of the edge between each pair of vertices (or ∞ if there is no direct edge).
This is different from the adjacency matrix and is used in shortest path algorithms.
Two graphs G1 and G2 are isomorphic if there is a bijection (one-to-one correspondence) between their vertex sets that preserves edges.
Informally: two graphs are isomorphic if one can be redrawn to look exactly like the other.
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.