A Greedy Algorithm to find MST by BFS
Algorithm
- Create a Minimum Priority Queue of visited nodes
visited[]- Additional operation
decrease-priority(vertex, new-priority)
- Additional operation
- Pick an arbitrary node, add node to
visitedlist - Look at all visit-able edges from nodes inside the visited list, add the minimum edge’s node to the
visitedlist if it is not already within thevisitedlist - priority(v) = minimum weight of any edge between v and tree
- priority(v) = inf if no such edge
Complexity
- Vertex enter/leave min-heap: each, full
- Edge call decrease-priority: each for full
- Rest dont per vertex or edge
- Total worst case: