Settings

Instructions:

Simulate the behavior of Prim's Algorithm for the given graph below. Click on the appropriate edge (parent, node) to enqueue or update a node in the Priority Queue (PQ). Click Dequeue to remove the node from PQ, and to add a node to the spanning tree. Begin from node A. The table contains the known shortest distance from A to each node alongside its parent node.

Created with Raphaël 2.1.2
A
B
C
D
E
F
G
H
I
J
K
L
M
N
5
8
2
8
6
9
3
3
7
7
5
1
6
2
8
8
Priority Queue
Legend
Graph edgeEnqueued edgeSpanning tree edge5 C (B)C has distance 5with parent B
  1. Node
  2. A
  3. B
  4. C
  5. D
  6. E
  7. F
  8. G
  9. H
  10. I
  11. J
  12. K
  13. L
  14. M
  15. N
  1. Distance
  2. 0
  1. Parent
  2. -
  3. -
  4. -
  5. -
  6. -
  7. -
  8. -
  9. -
  10. -
  11. -
  12. -
  13. -
  14. -
  15. -