Prim's Algorithm


Introduction

Dijkstra's algorithm helps you find the shortest paths through an existing network.  But, what happens if you only have the nodes?  Which network connections should you select so that you can wire together all of the computers for the minimum cost?  In this context, minimum cost implies no redundant links -- there is exactly one route to get to each computer (not safe, but you get what you pay for).  Effectively, you want to find the minimum-cost spanning tree for your computers, and this problem can be solved by Prim's algorithm.
 

Resources

Back to Main Menu