Lesson 3: Adjacency matrices
Constructing an adjacency matrix
SkillAdjacency matrices
Worked example
Construct the adjacency matrix for the graph shown.
Step 1: Label the rows and the columns
Use the same order for both: . The entry in row , column is the number of edges joining vertex to vertex .
Step 2: Fill in row A
to : one loop, so enter 1. to : 1. to : 0. to : 1. Row is .
A loop is one edge joining to itself, so it is entered as 1. (QCAA marks a loop entered as 1.)
Step 3: Fill in rows B, C and D
Row : , because two edges join and . Row : . Row : .
Step 4: Write the matrix and check its symmetry
The matrix is symmetric about the leading diagonal, as it must be for a graph without arrows.
An edge joining and also joins and , so the entry in row , column equals the entry in row , column .
Step 5: Check the number of edges
Entries above the leading diagonal: edges between different vertices. The diagonal adds 1 loop. That makes 7 edges, matching the drawing. ✓
Answer
Try a similar one
A fresh question of the same kind, checked as you answer, with hints and a full solution.
Method
Label the rows and columns with the vertices, in the same order.
Each entry is the number of edges joining the row vertex to the column vertex; a loop is entered as 1.
Check the matrix is symmetric and that the edge count matches the drawing.
Watch out for
Entering the loop as 2. The degree of counts the loop twice, but the matrix counts edges, so the entry is 1.
Entering 1 for the pair of edges between B and C instead of 2.