Welcome to My Assignment
This page is about Prim's Algorithm.
Prim's Algorithm finds the MST for a connected and undirected graph.
- First, it starts with a node provided as a parameter
- Then, it adds the smallest edge that connects a node in the tree to another new node
- It then adds the weight of all the edges connected to the new node into a priority queue
- It continues to add the smallest edge from the priority queue to the tree
- If the edge that has the smallest weight in the queue is already visited, it is skipped
- It repeats this process until all nodes are included in the tree
Here is an image showing the steps:
For more information on Prim's Algorithm, visit the Wikipedia page.