Design, test and refine solutions to spatial problems using algorithms and digital tools; communicate and justify solutions.
An algorithm is a set of steps that always works, so you never have to be clever. Two are worth knowing: the cheapest route between two places, and the cheapest way to connect everything.
Builds onYr 10 · Networks and Connectedness
Method
An algorithm must terminate
Every run must end, and end with an answer. A rule that could loop forever is not an algorithm.
Shortest path is not fewest edges
A two-edge route can cost more than a three-edge one. Always add the weights.
Greedy means cheapest next, every time
At each step take the cheapest option available. Simple to run, and easy to justify.
A spanning tree has no loops
E=V−1
Connecting $V$ places always needs exactly $V-1$ edges. One more would create a loop and waste money.
Justify by comparing
A solution is only complete when you show the alternatives cost more.
Worked example
e.g.Five towns with the road costs shown. Find the cheapest route A→E, then the cheapest way to link all five.
Write the network out with every weight before you start.
Shortest path. List every route from A to E and total each one.ABDE=4+5+3=12ACDE=2+8+3=13ACBDE=2+1+5+3=11
Choose the smallest total, not the fewest roads.ACBDE=11
Cheapest connector. Now a different question: link all five towns for the least total cost.we need 5−1=4 roads
Sort every road by cost, cheapest first.BC(1),AC(2),DE(3),AB(4),BD(5),CD(8)
Take them in order, but skip any road that would form a loop.take BC,AC,DEskip AB (loop)take BD
Stop once you have V−1 roads. Add the costs.1+2+3+5=11
Justify it. Say why the rejected road was rejected.AB was skipped because A,B,C were already joined
Practice
Add weights, never count edges.
1
A route uses 2 roads costing 9 and 7. Another uses 4 roads costing 3, 2, 4 and 3. Which is cheaper?
Answer16 vs 12∴the four-road route
2
How many edges are needed to connect 9 places with no loops?
Answer9−1=8
3
While building a cheapest connector you reach a road joining two already-linked towns. What do you do?
AnswerSkip it — it would form a loop and add cost without connecting anything new.
4
Why is taking the cheapest road at every step enough to justify a cheapest connector?
AnswerAny swap for a dearer road can only raise the total, so no cheaper set exists.
5
A network has 6 vertices and 5 edges and is connected. Can it contain a loop?
AnswerNo. 6−1=5, so it is exactly a spanning tree.
6
Why must an algorithm be written so it always terminates?
AnswerA procedure that can run forever never produces an answer, so it cannot be used to solve the problem.
Next step
Practise Algorithms on Networks with instant marking
A free 10-minute placement check finds which Year 10 topics to work on first, then Summit builds a weekly plan around them.