topic badge
AustraliaVIC
VCE 11 General 2023

8.02 Degree and adjacency matrices

Lesson

Degree and adjacency matrices

The degree of a vertex is the number of edges that either go into or out of a vertex, where loops are counted twice. This number tells us how many ways we can move from that vertex to another (or even the same) vertex within the network.

A useful trick is to make a ring close around the vertex - count up the number of times that edges cross the ring at a vertex, and you’ll have the degree:

Each vertex has a small ring placed around it, and the number of crossings are counted up. If you do it this way you’ll always remember to count loops twice!

 

Adjacency matrices - undirected networks

It is sometimes useful to use a table (its proper name is the adjacency matrix) to represent a network. This is a square array of numbers, one row and column for each vertex, that records how many connections there are between the vertices. For an undirected network, the entry for a particular row and column represents the number of edges connecting the matching vertices.

Here’s a simple network with $5$5 vertices:

Now we can create a table, with one row and column for each vertex:

Then we put the number edges connecting two vertices as the corresponding table entry. Let’s start by filling out the first row by putting a $1$1 if it is connected to $A$A, and a $0$0 if it isn’t.

$0$0 comes first, because $A$A isn’t connected to itself (there’s no loop at $A$A), and $A$A is connected to $B$B, $C$C, $D$D, and $E$E, so we put a $1$1 for each other entry in the table.

Since these edges are undirected, we can fill out the first column with the same numbers - if $A$A is connected to $B$B, then $B$B is connected to $A$A, and so on:

Now to fill out the second row, we notice that $B$B is connected to $A$A (already recorded), not itself (no loop), and it is connected to $C$C, $D$D, and $E$E:

We then record the remaining connections between $C$C, $D$D, and $E$E in the same way:

This is our completed table! Notice that:

  • The diagonal running top-left to bottom-right (called the main diagonal) has only $0$0's.
    This represents how no edge is connected to itself in the network - there are no loops.
  • The numbers not on the main diagonal are only $0$0’s and $1$1’s.
    This represents how no vertex is connected to any other by more than one edge.

All adjacency matrices representing simple networks will have these features.

As an added bonus the sum of all the entries in a row (or column) gives us the degree of the corresponding vertex - we can tell from the table that $C$C and $E$E have degree $2$2, $D$D has degree $3$3, and $A$A and $B$B have degree $4$4. This trick doesn't work if the network has loops, though - in such a case, numbers on the main diagonal need to be doubled, to make sure they're counted twice.

 

Adjacency matrices - directed networks

Now for a directed network, the entry in a particular row and column indicates the number of edges going from the corresponding row vertex to the corresponding column vertex. Here’s a directed, non-simple network with $5$5 vertices and its corresponding table:

This table looks a little different from the last one! Notice that:

  • The table is not symmetrical across the main diagonal (an edge from $A$A to $B$B can exist without an edge from $B$B to $A$A),
  • There is a $1$1 on the main diagonal (there is a loop at $C$C), and
  • There’s a $2$2 in the table (there are two edges from $D$D to $E$E).

While an asymmetrical table means the network is directed, there are directed networks that produce symmetrical tables.

 

Creating networks

Up until now we have been using networks to make adjacency matrices. But we can go back the other way - the information in these tables, and knowing whether the network is directed or undirected, is enough for us to create the network!

Here’s a table with $6$6 rows and columns (so there are $6$6 vertices in the network), and we are also told that the network is undirected.

This is a representation of the network that we get when we draw it out:

  • start with the first row, and the vertex on the left
  • draw in the edges connected to that vertex
  • move on to the next row/next vertex clockwise, ignoring the numbers below the main diagonal - they get drawn into the network when we do earlier rows for undirected networks. If the graph is directed, all the numbers need to be turned into edges.

 

Practice questions

Question 1

Consider this network:

  1. What is the degree of vertex $C$C?

  2. What is the degree of vertex $D$D?

Question 2

Fill in the adjacency matrix for this network:

  1.     $A$A $B$B $C$C $D$D    
    $A$A   $\editable{}$ $\editable{}$ $\editable{}$ $\editable{}$    
    $B$B   $\editable{}$ $\editable{}$ $\editable{}$ $\editable{}$    
    $C$C   $\editable{}$ $\editable{}$ $\editable{}$ $\editable{}$    
    $D$D   $\editable{}$ $\editable{}$ $\editable{}$ $\editable{}$    
  2. What is the degree of vertex $A$A?

Isomorphic graphs

There are many different but equivalent representations of a graph. Rearranging the vertices and edges while maintaining the same connectivity retains the underlying structure of a graph. This is known as an isomorphic graph

The following three graphs are isomorphic, with colour indicating corresponding vertices:

**Image coming soon

 

Two graphs are isomorphic if each of the following is true:

  1. They have the same number of vertices
  2. They have the same number of edges
  3. They have a matching number of vertices of each degree
  4. Corresponding vertices connect in the same way

 

Worked example:

Example 1

Determine if Graph A and Graph B are isomorphic. Justify your answer.

Graph A Graph B

Think: Do the graphs have the same structure? Are there the same number of vertices and edges connected in the same way?

Do: Both graphs have the same number of vertices and edges. However, Graph B has a vertex of degree $2$2 in the top right, whereas Graph A has no vertex of degree $2$2. So, there cannot be a way to rearrange Graph B to look like Graph A.

Graph A and Graph B are not isomorphic.

Reflect: If it is not quick to spot the graphs have a mismatched vertex of a particular degree, it is a good idea to list the degree for each vertex in the graph. If we create a list from largest to smallest this is known as the degree sequence of the graph and makes for easy comparison. For example, Graph A has the degree sequence $\left(4,3,3,3,3\right)$(4,3,3,3,3) and Graph B has degree sequence $\left(4,4,3,3,2\right)$(4,4,3,3,2).  By quick comparison the sequences are not equal and therefore, the graphs are not isomorphic. If the sequences were equal we would then need to check the connections were equivalent, this can be a complex task for large networks. 

Outcomes

U2.AoS2.1

the language, properties and types of graphs, including edge, face, loop, vertex, the degree of a vertex, isomorphic and connected graphs, and the adjacency matrix, Euler’s formula for planar graphs, and walks, trails, paths, circuits, bridges and cycles in the context of traversing a graph

U2.AoS2.8

construct graphs, digraphs and networks and their matrix equivalents to model and analyse practical situations

What is Mathspace

About Mathspace