kruskal, a Python code which implements Kruskal's algorithm to compute a minimal spanning tree of a weighted graph.
For a graph of VN nodes and EN edges, the algorithm expects to work with a ENx3 EDGES array, with each row containing values W, I, J, representing the weight and two end nodes of an edge.
The algorithm returns an (VN-1)x3 LINKS array, listing triples (W,I,J) representing the weight and links of the edges forming the spanning tree.
The information on this web page is distributed under the MIT license.