Build the lightest network across all vertices. Review chosen edges, running cost, and spanning structure. Plot weights, export reports, and inspect each selection clearly.
Use a stacked page layout, while the calculator fields flow in 3 columns on large screens, 2 on medium screens, and 1 on small screens.
Prim's algorithm expands a tree by repeatedly selecting the lightest edge that connects one included vertex to one excluded vertex.
Selection rule
Choose e = (u, v) with minimum w(e), where u is already in the tree and v is outside it.
Total tree weight
W(T) = Σ w(e) for every edge selected into the spanning tree.
For a connected graph with V vertices, the final tree contains exactly V - 1 edges and no cycles. The code uses an adjacency matrix approach, which is practical for small and medium graphs and follows a time complexity near O(V²).
| Edge | Weight | Comment |
|---|---|---|
| A - B | 4 | Connects the first pair of vertices. |
| B - C | 1 | Very light edge, often chosen early. |
| B - D | 2 | Links a new branch with low cost. |
| D - E | 5 | Adds another vertex to the tree. |
| E - F | 2 | Finishes the connection with low weight. |
It returns the minimum spanning tree, total tree weight, ordered edge selections, cumulative cost, adjacency matrix, graph density, and exportable summary tables.
For a connected graph with unique edge decisions, the total minimum weight remains the same. Different equal-weight ties can change edge order or structure, but still produce a valid minimum spanning tree.
Yes. The parser accepts integers and decimals. Use the precision field to control how many decimal places appear in the displayed tables and download files.
A single spanning tree cannot cover every vertex. The calculator highlights that condition and shows which vertices were left outside the tree so you can add missing connecting edges.
If the same undirected pair appears more than once, the calculator keeps the smallest weight. That reflects the cheapest available direct connection between those two vertices.
No. Prim's algorithm minimizes the total weight of a spanning tree. Dijkstra's method minimizes shortest-path distance from one source vertex to every reachable vertex.
For a connected graph with V vertices, any spanning tree must contain exactly V minus 1 edges. More edges create cycles, and fewer edges leave the graph disconnected.
Use it when you need the cheapest network without cycles, such as cable routing, road design, pipe layouts, cluster linking, or other weighted graph problems.
Important Note: All the Calculators listed in this site are for educational purpose only and we do not guarentee the accuracy of results. Please do consult with other sources as well.