L9 - MST and Prims Flashcards
Define a Path, Cycle and a Tree…
Path - Any sequence of vertices through the graph.
Cycle - A path that returns to its starting point.
Tree - A graph that contains no cycles.
Define a spanning tree… What is their main property?
A path that touches all vertices and edges within the tree.
Contains no cycles.
Is there only 1 spanning tree?
No, there can be multiple.
Define the minimum spanning tree…
The spanning tree with the lowest weight or distance.
What is the input-output relation for MST’s?
For all input edges, find the minimum weight edges connected unvisited vertices.
Who conceptualised MST’s, and what was the reason?
Boruvka.
Designed for efficient electrical distribution networks.
What is a common algorithm used for finding MST?
Prims.
What are the 3 steps of Prims algorithm?
- Choose a random vertex A in the tree.
- Add lowest cost edge to some next vertex B.
- Repeat until all vertices have been visited.
** At each vertex, find the next lowest weight across the whole tree.
What is the time complexity of Prims?
- Quadratic complexity - O( V^2 )
Give proof of the time complexity of O( V^2 )
Outer loop is V - 1
For each iteration i, computer (V - i) and (V - i - 1)
V ( 2 ( V - i ) - 1 ) = O( V^2 )