Home   >   User Resources   >   Online Help   >   apaGraph.MinimumSpanningTree
 

 

Function index Version 3.0.0

apaGraph.MinimumSpanningTree(DistanceMatrix)

Excel=apaGraph.MinimumSpanningTree(DistanceMatrix)

Result

Returns the minimum spanning tree (MST) of a distance matrix as an edge list, using Kruskal’s algorithm.

Syntax

DistanceMatrix: n x n distance matrix

Remarks

Returns an (n-1) x 3 edge list: the first two columns contain the 1-based indices of the connected nodes and the third column their distance. Only the upper triangle of DistanceMatrix is used. Tied distances are allowed; in that case one of the possible minimum spanning trees is returned, all of which have the same total length.

Pressing Esc aborts the calculation; the function then returns "Calculation aborted by user."