commands → spanningtree

spanningtree(A)

The spanningtree command takes a symmetric adjacency matrix A whose entries are edge weights and computes a minimal spanning tree for the weighted graph.

Examples

A = [[0,1,4],[1,0,1],[4,1,0]];
spanningtree(A);
	[[0, 1, 4], [1, 0, 0], [4, 0, 0]]