CSE221 · Algorithms

Prim's MST Simulator

Grow a minimum spanning tree one cheapest frontier edge at a time.

42632581734ABCDEFGH

Start the tree at A. Prim grows one node at a time.

step 1 of 16
expanding nowinspectingin frontierdone / in treeuntouched

Prim's Algorithm

Grows a single tree from a start node, each round taking the cheapest edge that leaves the tree.

Time
O(E log V)

Frontier edges

empty

Edges chosen
0
Total weight
0

Build your graph

—

Edges (11)

  • A — B(4)
  • A — D(2)
  • B — C(6)
  • B — E(3)
  • C — F(2)
  • D — E(5)
  • D — G(8)
  • E — F(1)
  • E — G(7)
  • F — H(3)
  • G — H(4)
Start node

← → to step, or use the buttons above.