Leaving Certificate Applied Mathematics2.3 Representing a network: adjacency matrices

All books

2.3 Representing a network: adjacency matrices — Practise with help

Warm-up: remember

  1. A network has edges ABAB, BCBC, CACA. What is the degree of each vertex?
  2. Is that network connected, and has it an Eulerian trail?
Answers and feedback
  1. Every vertex has degree 22 — it is the triangle.
  2. It is connected, and all degrees are even, so it has an Eulerian circuit.

Practise with help

1. A network has vertices A,B,CA, B, C and edges ABAB, BCBC. Write its adjacency matrix in the order A,B,CA, B, C.

Hint

Three vertices, so a 3×33 \times 3 matrix. Row AA has a 11 only in column BB.

Next step

ABAB and BCBC are the only edges, so row AA is 0,1,00,1,0 and row BB is 1,0,11,0,1.

Full working (010101010)\begin{pmatrix} 0&1&0\\ 1&0&1\\ 0&1&0 \end{pmatrix}

Row BB has two 11s because BB is joined to both AA and CC. The matrix is symmetric, as an undirected network's must be.

2. For the matrix (0111100110001100)\begin{pmatrix} 0&1&1&1\\ 1&0&0&1\\ 1&0&0&0\\ 1&1&0&0 \end{pmatrix}, find the degree of each vertex.

Hint

Add each row.

Next step

Row 1 is 0+1+1+10+1+1+1, row 2 is 1+0+0+11+0+0+1.

Full working
  • Vertex 1: 0+1+1+1=30+1+1+1 = 3
  • Vertex 2: 1+0+0+1=21+0+0+1 = 2
  • Vertex 3: 1+0+0+0=11+0+0+0 = 1
  • Vertex 4: 1+1+0+0=21+1+0+0 = 2

Check the handshake lemma: 3+2+1+2=83+2+1+2 = 8, so E=4E = 4. The matrix has four 11s in each triangle above and below the diagonal, which is 88 entries in total, so E=4E = 4. Both agree.

3. A directed network has arrows 1→21 \to 2, 2→32 \to 3, 3→13 \to 1 and 1→31 \to 3. Write its adjacency matrix and find the out-degree of each vertex.

Hint

Row ii records the arrows leaving ii.

Next step

Row 1 has arrows to 2 and to 3, so row 1 is 0,1,10,1,1.

Full working (011001100)\begin{pmatrix} 0&1&1\\ 0&0&1\\ 1&0&0 \end{pmatrix}

Out-degrees are the row sums: 2,1,12, 1, 1. The matrix is not symmetric — the entry in row 1, column 3 is 11, but row 3, column 1 is 11 while row 2, column 1 is 00 against row 1, column 2 being 11. Check the in-degrees as a cross-check: the column sums are 1,1,21, 1, 2, and they must add to the same total as the out-degrees, 44, which they do.

4. A network's adjacency matrix has row sums 3,3,2,2,23, 3, 2, 2, 2. How many edges has the network?

Hint

The row sums are the degrees.

Next step

Add them and halve.

Full working

The degrees are 3,3,2,2,23, 3, 2, 2, 2, adding to 1212. So

E=122=6E = \frac{12}{2} = 6

Here EE is the number of edges.

You did not need the matrix itself — only its row sums. That is the handshake lemma, and it is the quickest way to count edges from a matrix.

5. A weighted network has vertices A,B,C,DA, B, C, D with AB=3AB = 3, AC=8AC = 8, BD=4BD = 4, CD=1CD = 1. Write the weighted adjacency matrix and find the sum of the weights at BB.

Hint

Put the weight in the matrix where the 11 would go.

Next step

Row BB has 33 in column AA and 44 in column DD.

Full working (0380300480010410)\begin{pmatrix} 0&3&8&0\\ 3&0&0&4\\ 8&0&0&1\\ 0&4&1&0 \end{pmatrix}

The weights at BB are 3+4=73 + 4 = 7. This is the sum of the weights, not the degree of BB: the degree is 22, because only two edges meet BB. Keeping the two ideas apart matters whenever a weighted network is used to answer a route question.

6. A student writes down the adjacency matrix (1110)\begin{pmatrix} 1&1\\ 1&0 \end{pmatrix} for a network with no loops. Say what is wrong and give the correct matrix.

Hint

What does the diagonal entry represent?

Next step

The diagonal is the vertex joined to itself.

Full working

The 11 in the top-left is on the diagonal, and a diagonal entry means a loop — the vertex joined to itself. The network has no loops, so every diagonal entry must be 00. The correct matrix is

(0110)\begin{pmatrix} 0&1\\ 1&0 \end{pmatrix}

A diagonal entry is the easiest thing to get wrong when filling a matrix in a hurry, because it is the one entry that is never 11 in a simple network.

A question from Section 2.2

7. The adjacency matrix of a network is symmetric and every row sums to 22. Is the network connected? Does it have an Eulerian trail?

Hint

The matrix tells you the degrees, not the shape.

Next step

Every degree is 22, so every degree is even.

Full working

Every vertex has degree 22, so there are 00 odd-degree vertices. If the network is connected, it has an Eulerian circuit.

But the matrix does not tell you whether it is connected. Two separate triangles each have every row summing to 22 and a symmetric matrix, and neither is connected. The Eulerian test needs connectedness as well, and connectedness is a property of the shape that the adjacency matrix holds only implicitly — you have to read it back out to check.

8. Explain how the handshake lemma appears in an adjacency matrix.

Hint

Count all the 11s two ways.

Next step

Each edge puts two 11s in the matrix, one in row ii column jj and one in row jj column ii.

Full working

An edge between ii and jj puts a 11 at (i,j)(i, j) and a 11 at (j,i)(j, i) — two entries. So the total number of 11s in the whole matrix is twice the number of edges.

But the total of all the entries is also the total of all the row sums, and a row sum is a degree. So

∑deg⁡(v)=total of all entries=2E\sum \deg(v) = \text{total of all entries} = 2E

where vv is a vertex. This is exactly the handshake lemma. The lemma is not a fact about drawings; it is a fact about the matrix, and that is why it is always true.

Settings

Colour scheme

Light or dark pages. Your colour and layout stay the same.

Colour

The paper, ink and lettering. Your layout stays the same.

Quiet colours
Bold colours
Layout

How pages are arranged. Your colours stay the same.

Reading offline

Keep this book on this device and read it offline.