Simple high level implementation
suggest changeSort the edges by value and add each one to the MST in sorted order, if it doesn’t create a cycle.
algorithm kruskalMST(G: a graph) sort G's edges by their value MST = an empty graph for each edge e in G: if adding e to MST does not create a cycle: add e to MST return MST
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents