Skip to main content

Graphs, trees and shortest path: VCE General Mathematics Unit 4 Networks and decision mathematics

Syllabus dot point

“Use graph and network terminology (vertices, edges, degree, connected, planar), apply Euler's formula and the handshake result, find a minimum spanning tree, and determine the shortest path through a weighted network”

15 min read

Quick answer

A graph is a set of vertices joined by edges; a network is a graph with weights on its edges. The degree of a vertex is the number of edges at it (a loop counts 2), and the sum of all degrees is twice the number of edges. A planar graph can be drawn with no edges crossing; for a connected planar graph, Euler's rule v+f=e+2v + f = e + 2 holds, where the faces include the outer region. A tree is a connected graph with no cycles and has v−1v - 1 edges; a spanning tree is a tree that uses every vertex of a graph. A bridge is an edge whose removal disconnects the graph. Adjacency matrices record the number of edges between each pair of vertices.

Jump to a section
  1. What this dot point is asking
  2. The answer
  3. Where these ideas lead
  4. Exam-style questions
  5. Practice questions

What this dot point is asking

Under "Graphs and networks" the Study Design lists "the concepts, conventions and terminology of graphs including planar graphs and Euler's rule, and directed (digraphs) and networks" and "use of matrices to represent graphs, digraphs and networks and their application". Trees and spanning trees are listed under "Trees and minimum connector problems". This page covers that vocabulary and the counting results that go with it. The algorithms that use it have their own pages: Prim's algorithm for minimum spanning trees and Dijkstra's algorithm for shortest paths.

Graph fundamentals are the most reliable marks in Networks. On recent papers the degree sum and Euler's rule were answered correctly by 76%76\% to 91%91\% of students (2023 Examination 2 Question 12, 2025 Examination 2 Question 15). The misses were in adjacency matrices (2023 Examination 1 Question 37, 66%66\%; 2025 Examination 2 Question 16, only 20%20\% full marks) and in vocabulary questions that ask how many statements are true (2023 Examination 1 Question 33, 56%56\%).

The answer

Vertices, edges and degree

  • A graph is a set of vertices (points) joined by edges (lines). Only which vertices are joined matters, not the shape or length of the lines.
  • A loop joins a vertex to itself. Multiple edges join the same pair of vertices more than once. A simple graph has neither.
  • The degree of a vertex, deg⁡(V)\deg(V), is the number of edges that meet at it. A loop adds 2 to the degree (both ends are at that vertex). A vertex of degree 0 is isolated.
  • A graph is connected if there is a route between every pair of vertices. A bridge is an edge whose removal would disconnect a connected graph; an edge that lies on a cycle is never a bridge.
  • A complete graph KnK_n has every pair of its nn vertices joined by one edge, so it has n(n−1)2\frac{n(n-1)}{2} edges.
  • A directed graph (digraph) has arrows on its edges; a network has a number (weight) on each edge, such as a distance, time, cost or capacity.
  • A bipartite graph has two groups of vertices, with edges only between the groups. It models matching and allocation problems.

The sum of degrees

Each edge has two ends and adds 1 to the degree of each end (or 2 to one vertex, for a loop). So

sum of the degrees of all vertices=2×number of edges.\text{sum of the degrees of all vertices} = 2 \times \text{number of edges}.

Two consequences: the degree sum is always even, and the number of odd-degree vertices is always even. Both are used constantly in the Eulerian-trail questions on the Euler and Hamilton page.

Planar graphs and Euler's rule

A graph is planar if it can be drawn with no edges crossing, even if the drawing you are given has crossings (redraw an edge around the outside to check). A planar drawing divides the plane into faces: the regions bounded by edges, plus the outer region.

For any connected planar graph,

v+f=e+2,v + f = e + 2,

where vv is the number of vertices, ff the number of faces and ee the number of edges. The rule fails for disconnected graphs and cannot be applied to non-planar graphs (such as K5K_5), which is why "connected and planar" is the answer to "why does Euler's rule hold" (2023 Examination 2 Question 12b, 81%81\%).

A planar graph with its faces and vertex degreesFive vertices A to E with seven edges: A to B, A to C, B to C, B to D, C to D, C to E and D to E. The degrees are A 2, B 3, C 4, D 3 and E 2, which add to 14, twice the number of edges. No edges cross, so the graph is planar. It divides the plane into four faces: triangle A B C, triangle B C D, triangle C D E and the outer face surrounding the graph. Euler's formula checks: 5 vertices plus 4 faces equals 7 edges plus 2.F1F2F3F4 (outer face)Adeg 2Bdeg 3Cdeg 4Ddeg 3Edeg 2v = 5, e = 7, f = 4: 5 + 4 = 7 + 2. Degree sum 2 + 3 + 4 + 3 + 2 = 14 = 2 x 7.

Adjacency matrices

The adjacency matrix of a graph with nn vertices is an n×nn \times n matrix whose element in row ii, column jj is the number of edges joining vertex ii to vertex jj.

  • For an undirected graph it is symmetric.
  • Multiple edges give elements greater than 1.
  • VCAA records a loop as 1 on the leading diagonal, but a loop adds 2 to the degree. So the degree of a vertex is its row total plus the number of loops at it.
  • For a graph with no loops, the sum of all elements is 2e2e, so e=sum of elements2e = \frac{\text{sum of elements}}{2}.
  • For a digraph, the element in row ii, column jj counts the arrows from ii to jj, and the matrix need not be symmetric (communication and dominance matrices are examples).

2025 Examination 2 Question 16 gave a map of passages between five areas of a gym and an adjacency matrix with three unknown elements, including 1s on the leading diagonal for passages that lead from an area back to itself. The answer was x=2x = 2, y=4y = 4, z=2z = 2; only 20%20\% got all three, and yy was often given as 3. Count every separate route between two areas that does not pass through another area.

Trees and spanning trees

A tree is a connected graph with no cycles. Every tree with vv vertices has exactly v−1v - 1 edges, every edge of a tree is a bridge, and a tree is planar with only one face (so v+1=(v−1)+2v + 1 = (v - 1) + 2).

A spanning tree of a connected graph is a tree that includes every vertex of the graph, using only edges of the graph. A graph usually has many spanning trees. To draw one, keep adding edges from the original graph that reach a new vertex, until all vv vertices are joined by v−1v - 1 edges.

In a weighted network, a minimum spanning tree is a spanning tree of least total weight: the cheapest way to connect every vertex (a minimal connector problem). Find it by inspection or by Prim's algorithm (start anywhere, repeatedly add the cheapest edge that reaches a new vertex). The shortest path between two vertices is a different problem: the cheapest route from one vertex to another, found by inspection or Dijkstra's algorithm.

Formula

Sum of degrees =2e= 2e (a loop adds 2). KnK_n has n(n−1)2\frac{n(n-1)}{2} edges. Connected planar graph: v+f=e+2v + f = e + 2 (faces include the outer face). Tree: connected, no cycles, e=v−1e = v - 1. Adjacency matrix with no loops: e=12×e = \frac{1}{2} \times sum of elements.

Worked examples: degrees, faces, matrices and trees

Degrees and Euler's rule (2023 Examination 2 Question 12)

The border graph has edges A-B, A-C, B-C, B-D, C-D, C-E and D-E.

Step 1: degrees
A 2, B 3, C 4, D 3, E 2. Sum 14.
Step 2: check with the edges
2×7=142 \times 7 = 14. Good.
Step 3: faces
Three triangles (ABC, BCD, CDE) and the outer face: f=4f = 4. Euler's rule: 5+4=7+25 + 4 = 7 + 2.
Step 4: the condition
The graph is connected and planar.

Faces from an adjacency matrix (2023 Examination 1 Question 37)

Step 1: edges. The row totals are 3, 5, 4, 4 and 4, so the elements add to 20. There are no loops, so each edge is counted twice: e=202=10e = \frac{20}{2} = 10.

Step 2: faces. 5+f=10+25 + f = 10 + 2, so f=7f = 7. Answer: B.

Counting bridges (2025 Examination 1 Question 34)

The graph is three triangles joined by a chain of three edges.

Step 1: rule out cycle edges. Every edge of a triangle lies on a cycle, so none is a bridge.

Step 2: test the rest. Removing any one of the three chain edges splits the graph into two pieces. Three bridges: C (85%85\%).

How many statements are true? (2023 Examination 1 Question 33)

A chain of five vertices and four edges: it is a tree (true), connected (true), contains a path (true), contains no cycle (so "contains a cycle" is false), and its degrees 1+2+2+2+1=81 + 2 + 2 + 2 + 1 = 8 (true). Four true: D. Treat each statement separately and mark it T or F before counting.

A spanning tree (2025 Examination 2 Question 15d)

Step 1: count. 5 vertices, so the tree needs 4 edges.

Step 2: build. Start at the coffee shop and join it to the gym, supermarket, pet shop and home (all four are edges of the original graph). No cycle is formed and every vertex is reached. Any other set of 4 original edges with no cycle is also correct.

Common traps
Counting a loop as 1 for the degree
A loop adds 2 to the degree, even though it appears as 1 in the adjacency matrix.
Taking the matrix total as the number of edges
For an undirected graph with no loops, halve it (2023 Examination 1 Question 37: 20÷2=1020 \div 2 = 10 edges, not 20).
Forgetting the outer face
Euler's rule counts the region outside the graph as a face.
Applying Euler's rule to a drawing with crossings
First check the graph is planar and connected; redraw it without crossings if you can.
Answering "complete" instead of "planar"
Euler's rule needs connected and planar; a complete graph such as K5K_5 is not planar.

Adding an edge that is not in the original graph when drawing a spanning tree.

Confusing a minimum spanning tree with a shortest path. The tree connects every vertex; the path joins two.

Exam technique

Write the degree beside every vertex as soon as you see a graph; it answers degree-sum, Eulerian and tree questions at once. For Euler's rule, count vertices and edges carefully (tick each edge as you count it) and let the formula give the faces, then check by counting regions. For "how many statements are true", write T or F beside each statement before choosing.

Where these ideas lead

Every Networks topic uses this vocabulary. Degrees decide Eulerian trails and circuits; trees and spanning trees lead to Prim's algorithm; weighted networks lead to shortest paths (Dijkstra's algorithm) and flow problems; bipartite graphs lead to allocation with the Hungarian algorithm; and digraphs with arrows between tasks lead to critical path analysis. Adjacency matrices connect the Networks area of study to the Matrices area, where communication and dominance matrices are the adjacency matrices of digraphs.

Note

A graph is dots (vertices) joined by lines (edges). The degree of a dot is how many lines touch it, and adding up all the degrees always gives double the number of lines. If you can draw a graph with no lines crossing, it is planar, and then the number of dots plus the number of regions (counting the outside) equals the number of lines plus 2. A tree is a graph with no loops back to where you started; it always has one fewer line than dots. A spanning tree reaches every dot of a bigger graph using only its lines.

Exam-style questions

Questions in the style of VCAA exam questions on this dot point, each with a worked answer. They are written by ExamExplained unless tagged "Past paper"; the year shows the paper a question is modelled on.

2023 VCAA Exam 2 Q12a-bPast paper3 marks
A country has five states, A, B, C, D and E. A graph can be drawn with vertices to represent each of the states. Edges represent a border shared between two states. [Graph: edges A - B, A - C, B - C, B - D, C - D, C - E, D - E, drawn with no crossings.] a. What is the sum of the degrees of the vertices of the graph above? b. Euler's formula, v+f=e+2v + f = e + 2, holds for this graph. i. Complete the formula by writing the appropriate numbers in the boxes: □+□=□+2\square + \square = \square + 2. ii. Complete the sentence by writing the appropriate word in the box: Euler's formula holds for this graph because the graph is connected and □\square.
Show worked answer →

(a) Degrees: A 2, B 3, C 4, D 3, E 2. Sum == 14 (twice the 7 edges). (1 mark; 76%76\%.)

(b) i. v=5v = 5, e=7e = 7, so f=e+2−v=4f = e + 2 - v = 4: 5 + 4 = 7 + 2. The four faces are the three triangles ABC, BCD and CDE and the outer face. (1 mark; 90%90\%.)

(b) ii. planar: it can be drawn with no edges crossing. (1 mark; 81%81\%. Some answered "complete", which is wrong: K5K_5 is complete but not planar.)

Source: VCAA 2023 General Mathematics Examination 2, Question 12, and the 2023 examination report.

2025 VCAA Exam 2 Q15a,b,dPast paper3 marks
Frances lives in a housing estate. On the graph the vertices represent her favourite locations, and the edges represent the roads between them. [Graph: edges gym - coffee shop, gym - pet shop, coffee shop - supermarket, coffee shop - pet shop, coffee shop - home, supermarket - home, pet shop - home, drawn with no crossings.] a. Calculate the sum of the degrees of all the vertices in this graph. b. Euler's formula, v+f=e+2v + f = e + 2, holds for this graph. Complete the formula by writing the appropriate numbers in the boxes. d. Using edges from the original graph, construct a spanning tree.
Show worked answer →

(a) Degrees: gym 2, coffee shop 4, supermarket 2, pet shop 3, home 3. Sum =2+4+2+3+3== 2 + 4 + 2 + 3 + 3 = 14. (1 mark; 88%88\%.)

(b) v=5v = 5, e=7e = 7, f=4f = 4: 5 + 4 = 7 + 2. (1 mark; 91%91\%.)

(d) A spanning tree uses all 5 vertices and 5−1=45 - 1 = 4 edges with no cycle, for example gym - coffee shop, coffee shop - supermarket, coffee shop - pet shop, coffee shop - home. Many answers are possible. (1 mark; 81%81\%. The common error was an edge that is not in the original graph.)

Source: VCAA 2025 General Mathematics Examination 2, Question 15, and the 2025 examination report.

2023 VCAA Exam 1 Q34Past paper1 mark
A bipartite graph is typically used to display which one of the following? A. the allocation of tasks on a construction site B. the path used to visit five different construction sites C. the total distance travelled between two construction sites D. the critical path of activities to be completed in a construction project E. the minimum length of cable required to connect six construction sites
Show worked answer →

A bipartite graph has two groups of vertices, with edges only between the groups. That is the structure of an allocation (matching) problem: one group is the workers, the other the tasks, and an edge means "this worker can do this task".

Answer A (77%77\%). B is a path or Hamiltonian problem, C a shortest path, D critical path analysis and E a minimum spanning tree.

Source: VCAA 2023 General Mathematics Examination 1, Question 34, and the 2023 examination report.

2023 VCAA Exam 1 Q37Past paper1 mark
The adjacency matrix below represents a planar graph with five vertices (rows and columns J,K,L,M,NJ, K, L, M, N). [0101110211020111110111110]\begin{bmatrix}0&1&0&1&1\\1&0&2&1&1\\0&2&0&1&1\\1&1&1&0&1\\1&1&1&1&0\end{bmatrix} The number of faces on the planar graph is A. 5 B. 7 C. 9 D. 15 E. 17
Show worked answer →

Step 1: count the edges. The matrix is symmetric and has no loops, so each edge is counted twice. Sum of all elements =3+5+4+4+4=20= 3 + 5 + 4 + 4 + 4 = 20, so e=10e = 10 (the 2 means there are two edges between K and L).

Step 2: Euler's rule. v+f=e+2v + f = e + 2: 5+f=10+25 + f = 10 + 2, so f=7f = 7. Answer B (66%66\%).

The trap is using 20 as the number of edges (f=17f = 17, option E).

Source: VCAA 2023 General Mathematics Examination 1, Question 37, and the 2023 examination report.

2025 VCAA Exam 1 Q34Past paper1 mark
Consider the following graph. [Graph: a triangle PQRPQR joined to a second triangle RSTRST at RR; a path of three edges P−U−V−WP - U - V - W from PP; and a triangle WXYWXY at WW. (Labels added; the paper's graph was unlabelled.)] The number of bridges in this graph is A. 1 B. 2 C. 3 D. 4
Show worked answer →

A bridge is an edge whose removal disconnects the graph. An edge in a cycle is never a bridge, because the rest of the cycle still joins its ends.

The three triangles are cycles, so none of their edges are bridges. Each of the three edges of the path P−U−V−WP - U - V - W is the only link between the two halves of the graph, so each is a bridge. Answer C, 3 bridges (85%85\%).

Source: VCAA 2025 General Mathematics Examination 1, Question 34, and the 2025 examination report.

2023 VCAA Exam 1 Q33Past paper1 mark
Consider the following graph. [Graph: five vertices joined in a chain by four edges, with no other edges.] How many of the following five statements are true? The graph is a tree. The graph is connected. The graph contains a path. The graph contains a cycle. The sum of the degrees of the vertices is eight. A. 1 B. 2 C. 3 D. 4 E. 5
Show worked answer →
  • Tree: connected with no cycles. True.
  • Connected. True.
  • Contains a path. True (the whole chain is a path).
  • Contains a cycle. False: there is no closed route.
  • Sum of degrees =2×4= 2 \times 4 edges =8= 8. True.

Four statements are true: D (56%56\%; 30%30\% chose C, usually by missing that a tree still contains paths).

Source: VCAA 2023 General Mathematics Examination 1, Question 33, and the 2023 examination report.

Practice questions

Original practice questions graded from foundation to exam level, each with a full worked solution. Try them before revealing the solution.

foundation2 marks
A connected graph has 6 vertices with degrees 1, 2, 2, 3, 3 and 5. (a) How many edges does it have? (b) Can it be a tree?
Show worked solution →

(a) Sum of degrees =16=2e= 16 = 2e, so e=8e = 8. (1 mark)

(b) No. A tree with 6 vertices has exactly 6−1=56 - 1 = 5 edges; this graph has 8, so it must contain a cycle. (1 mark)

foundation1 mark
A connected planar graph has 8 vertices and 12 edges. How many faces does it have?
Show worked solution →

v+f=e+2v + f = e + 2: 8+f=12+28 + f = 12 + 2, so f=6f = 6 (including the outer face). (1 mark)

core3 marks
A graph with vertices P, Q, R and S has adjacency matrix [0210210110010110]\begin{bmatrix} 0 & 2 & 1 & 0 \\ 2 & 1 & 0 & 1 \\ 1 & 0 & 0 & 1 \\ 0 & 1 & 1 & 0 \end{bmatrix} (a 1 on the leading diagonal represents a loop). (a) Describe the edges. (b) Find the degree of each vertex. (c) Find the number of edges.
Show worked solution →

(a) Two edges between P and Q, one P-R, a loop at Q, one Q-S and one R-S. (1 mark)

(b) A loop adds 2 to the degree. P: 2+1=32 + 1 = 3. Q: 2+1+2=52 + 1 + 2 = 5 (two edges to P, one to S, the loop). R: 2. S: 2. (1 mark)

(c) Sum of degrees =12= 12, so 66 edges. Check: P-Q, P-Q, P-R, Q-Q, Q-S, R-S. (1 mark) Adding the matrix elements gives 11, not 12, because the loop appears only once in the matrix.

core2 marks
(a) How many edges does the complete graph K6K_6 have? (b) Is K4K_4 planar? If so, verify Euler's rule for it.
Show worked solution →

(a) Every pair of 6 vertices is joined: 6×52=15\frac{6 \times 5}{2} = 15 edges. (1 mark)

(b) Yes: draw three vertices as a triangle and the fourth in the middle joined to all three. v=4v = 4, e=6e = 6, and there are three inner triangles plus the outer face, f=4f = 4: 4+4=6+24 + 4 = 6 + 2. (1 mark)

exam2 marks
A connected planar graph has 8 faces, and every vertex has degree 3. Find the number of vertices and the number of edges.
Show worked solution →

Sum of degrees: 3v=2e3v = 2e, so e=1.5ve = 1.5v. (1 mark)

Euler's rule: v+8=e+2=1.5v+2v + 8 = e + 2 = 1.5v + 2, so 0.5v=60.5v = 6, v=12v = 12 and e=18e = 18. (1 mark) Check: 12+8=18+212 + 8 = 18 + 2.

exam3 marks
A network has edges S-A 4, S-B 2, A-B 1, A-C 5, B-C 8, B-D 10, C-D 2, C-T 6 and D-T 3. (a) Find the shortest path from S to T and its length. (b) Find the length of a minimum spanning tree. (c) Explain why the answers to (a) and (b) are about different problems.
Show worked solution →

(a) Compare routes: S-B-A-C-D-T =2+1+5+2+3=13= 2 + 1 + 5 + 2 + 3 = 13; S-A-C-D-T =4+5+2+3=14= 4 + 5 + 2 + 3 = 14; S-B-A-C-T =2+1+5+6=14= 2 + 1 + 5 + 6 = 14; S-B-D-T =15= 15. Shortest: S-B-A-C-D-T, 13. (1 mark)

(b) Prim's algorithm from S: S-B 2, B-A 1, A-C 5, C-D 2, D-T 3. Total 13 (5 edges for 6 vertices). (1 mark)

(c) The shortest path is the cheapest way to travel between two vertices; the minimum spanning tree is the cheapest way to connect all vertices. They happen to use the same edges here, but in general they do not. (1 mark)

Practise this

Sources & how we know this

ExamExplained