Kruskal’s Minimum Spanning Tree Algorithm

I have a vast variety of stuff on that matter (but using C#: P is not my game at all). Notify if you want some example (but you can’t auto translate P > C#).

NOTE: For the general case (any graph) you should FIST cluster the Graph (into islands). The most effective way is to cluster the Connectivity (node-node) Tree … meaning working with ints … meaning real-time result no matter the N of nodes. Shown a Dijkstra/Kruskal take on a proximity Graph (that in real-life yields islands in most of cases).

BTW: In the last screenshot M is the Adjacency node-node distance Matrix (i.e. the cost IS the distance - but could be anything else) and VList is the List of nodes (in a given island). A Dijkstra routing is also displayed.