Kruskal's algorithm
Appearance
Kruskal's algoritm computes the shortest spanning tree in a graph.
It works as follows:
- sort the edges by length in ascending order
- take the first edge of this list and add it to the tree
- if you have reached the end of the list, stop
- consider the next edge on the list: if it will form a cycle when added to the tree, discard it; otherwise add it to the tree
- go back to step 3