How do we connect every site in a network at the least total cost?
Solve connector problems by finding a minimum spanning tree using Prim's algorithm and interpret its total weight.
How to solve a connector problem by finding a minimum spanning tree with Prim's algorithm, confirm it has n minus 1 edges, and interpret its total weight as the least connection cost.
Reviewed by: AI editorial process; not yet individually human-reviewed
Have a quick question? Jump to the Q&A page
Jump to a section
What this dot point is asking
You must solve connector problems with Prim's algorithm, confirm the tree has edges, and interpret the total weight.
Connector problems
A connector problem asks for the least-cost set of links that connects every vertex. The solution is a spanning tree: it spans (reaches) every vertex, and it is a tree (connected, no cycles). The minimum spanning tree has the smallest possible total weight.
Prim's algorithm
Prim's algorithm grows the tree outward from a starting vertex.
The key restriction is that each added edge must reach a new vertex; an edge joining two vertices already in the tree would form a cycle and is never added. (Kruskal's algorithm, which adds the globally cheapest cycle-free edge regardless of connection, gives the same minimum spanning tree.)
Kruskal's algorithm as an alternative
Kruskal's algorithm builds the same minimum spanning tree but works globally rather than growing from one vertex. List all edges in order of increasing weight, then add the cheapest edge that does not form a cycle, regardless of where it is in the network, until edges have been added. It is often quicker to apply on paper because you sort the edges once and work down the list, skipping any edge that would close a loop. Either algorithm gives the same minimum total weight; choose whichever is faster for the given network.
Interpreting the result
The total weight of the minimum spanning tree is the minimum total cost (length, dollars, cable) to connect every site. It is not the shortest route between two points; a connector problem is about linking everything, not travelling between two named vertices. Read the wording carefully: "connect all", "link every", "least cabling" signal a spanning tree.
In context, the tree's edges are the links that should actually be built, and its total weight is the figure you report (for example, "the cheapest network connecting all six towns uses these five roads and costs "). If a question asks whether a particular link is in the minimum spanning tree, run the algorithm and check; a link can be the cheapest single edge yet still be excluded if adding it would create a cycle with cheaper alternatives.
Exam-style practice questions
Practice questions written in the style of SCSA exam questions on this dot point, with worked answer explainers. The year tag is the paper they imitate, not the source.
WACE 20227 marksSix towns are to be joined by fibre cable. The possible links (cost in \AB=7AC=5BC=8BD=9CD=7CE=5DE=15DF=6EF=8A$ to find the minimum spanning tree. (b) State its total cost and the number of edges.Show worked answer →
Prim's adds the cheapest edge that reaches a new vertex.
Start at . Cheapest from : , add . Cheapest from : , add . Cheapest reaching a new vertex from : (or ); take , add . Cheapest reaching new: , add . Cheapest reaching : , add . (5 marks)
Edges: , , , , , that is edges for towns (). Total cost , that is . (2 marks)
Markers reward growing from by cheapest new-vertex edges, exactly edges, and total .
WACE 20244 marksExplain the difference between a minimum spanning tree and a shortest path, and state how many edges a minimum spanning tree of vertices contains.Show worked answer →
One connects everything; the other links two points.
A minimum spanning tree connects all vertices together at the least total weight with no cycles; it is about the whole network. A shortest path is the route of least total weight between two specific vertices only. (2 marks)
A minimum spanning tree of vertices has exactly edges. (2 marks)
Markers reward the connect-everything versus single-journey distinction and the edge count.
