# Spanning trees

*Graphs.jl* contains a few algorithms to compute minimum spanning trees.

## Index

## Full docs

`Graphs.boruvka_mst`

— Function`boruvka_mst(g, distmx = weights(g); minimize = true)`

Return a tuple `(mst, weights)`

where `mst`

is a vector of edges representing the optimum (minimum, by default) spanning tree of a connected, undirected graph `g`

with optional matrix `distmx`

that provides distinct edge weights, and `weights`

is the sum of all the edges in the solution by using Boruvka's algorithm. The algorithm requires that all edges have different weights to correctly generate a minimun/maximum spanning tree

**Optional Arguments**

`minimize=true`

: if set to`false`

, calculate the maximum spanning tree.

`Graphs.kruskal_mst`

— Function`kruskal_mst(g, distmx=weights(g); minimize=true)`

Return a vector of edges representing the minimum (by default) spanning tree of a connected, undirected graph `g`

with optional distance matrix `distmx`

using Kruskal's algorithm.

**Optional Arguments**

`minimize=true`

: if set to`false`

, calculate the maximum spanning tree.

`Graphs.prim_mst`

— Function`prim_mst(g, distmx=weights(g))`

Return a vector of edges representing the minimum spanning tree of a connected, undirected graph `g`

with optional distance matrix `distmx`

using Prim's algorithm. Return a vector of edges.