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

All books

2.3 Representing a network: adjacency matrices — Practise

Work independently. The questions and answers are shown together at the end.

State the vertex order before you write any matrix. A different order is a different matrix for the same network, and it is the commonest way to lose marks here.

  1. A network has vertices AA, BB, CC, DD and edges ABAB, ACAC, BCBC, CDCD. Write down its adjacency matrix, with the vertices in the order A,B,C,DA, B, C, D.
  2. For the matrix in the previous question, find the degree of CC by adding the entries in its row.
  3. In an undirected network's adjacency matrix, the entry in row AA, column BB is 11. What is the entry in row BB, column AA, and why?
  4. For the network with adjacency matrix (011101110)\begin{pmatrix} 0&1&1\\1&0&1\\1&1&0\end{pmatrix}, how many edges has it, and what is the sum of all the entries?
  5. A directed network has arrows A→BA \to B, A→CA \to C, B→CB \to C and C→AC \to A, with vertices in the order A,B,CA, B, C. Write its adjacency matrix.
  6. For that directed network, find the out-degree of AA and the in-degree of AA from its adjacency matrix.
  7. A weighted network has vertices P,Q,RP, Q, R with PQ=5PQ = 5 km, PR=2PR = 2 km and QR=7QR = 7 km. Write down the weighted adjacency matrix.
  8. A network has no loops. Explain how to read the degree of a vertex from the adjacency matrix, and state what changes if the network has a loop.

Answers and concise solutions

1. Show the answer

1. Adjacency matrix

Answer: (0110101011010010)\begin{pmatrix} 0&1&1&0\\ 1&0&1&0\\ 1&1&0&1\\ 0&0&1&0 \end{pmatrix}. The entry in row ii, column jj is 11 when the two vertices are joined and 00 when they are not.

2. Show the answer

2. Degree of C

Answer: Row CC is 1,1,0,11, 1, 0, 1, which adds to 33. In an adjacency matrix the sum of a row is the degree of that vertex.

3. Show the answer

3. The mirrored entry

Answer: It is also 11. An edge in an undirected network runs both ways, so if AA is joined to BB then BB is joined to AA. The adjacency matrix is therefore symmetric: the entry in row ii, column jj always equals the entry in row jj, column ii.

4. Show the answer

4. Number of edges, then the entry sum

Answer: Every row sums to 22, so each vertex has degree 22. Then E=(2+2+2)/2=3E = (2+2+2)/2 = 3: it is the triangle on three vertices. The sum of all the entries is 66, which is twice the number of edges — the same handshake lemma read off the matrix.

5. Show the answer

5. Adjacency matrix

Answer: (011001100)\begin{pmatrix} 0&1&1\\ 0&0&1\\ 1&0&0 \end{pmatrix}. The entry in row ii, column jj is 11 when there is an arrow from ii to jj, so the matrix is not symmetric: there is an arrow A→CA \to C but not C→AC \to A.

6. Show the answer

6. Out-degree, then in-degree

Answer: Row AA is 0,1,10, 1, 1 and adds to 22, so the out-degree is 22. Column AA is 0,0,10, 0, 1 and adds to 11, so the in-degree is 11. A row gives the out-degree; a column gives the in-degree.

7. Show the answer

7. Weighted adjacency matrix

Answer: (052507270)\begin{pmatrix} 0&5&2\\ 5&0&7\\ 2&7&0 \end{pmatrix}. The entry is the weight of the edge, not 11, and 00 still means there is no edge. A weighted adjacency matrix is symmetric for an undirected network, exactly as the unweighted one is.

8. Show the answer

8. Reading the degree

Answer: With no loops, the degree of a vertex is the sum of its row (or, in an undirected network, its column, since the matrix is symmetric). A loop changes this: it appears on the diagonal as a 11, but it contributes 22 to the degree because it leaves and arrives. So in a network with loops, the row sum is not the degree — add the diagonal entries separately.

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.