Skip to content

@graphty/algorithms / index / minimumSpanningTree

Function: minimumSpanningTree() ​

minimumSpanningTree(graph): MSTResult

Defined in: algorithms/mst/kruskal.ts:74

Alias for kruskalMST. Computes the minimum spanning tree of an undirected graph.

Parameters ​

graph ​

Graph

The undirected graph to compute the MST for

Returns ​

MSTResult

The minimum spanning tree as a set of edges and the total weight

Throws ​

Error if the graph is directed or not connected