Package com.jgalgo
Interface MinimumSpanningTree
-
public interface MinimumSpanningTree
Minimum spanning tree algorithm.A spanning tree is an edge sub set of the graph edges which form a tree and connect (span) all the vertices of the graph. A minimum spanning tree (MST) is a spanning tree with the minimum edge weights sum over all spanning trees.
- Author:
- Barak Ugav
- See Also:
- Wikipedia,
MinimumDirectedSpanningTree
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
MinimumSpanningTree.Builder
A builder forMinimumSpanningTree
objects.static interface
MinimumSpanningTree.Result
A result object forMinimumSpanningTree
computation.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description MinimumSpanningTree.Result
computeMinimumSpanningTree(Graph g, WeightFunction w)
Compute the minimum spanning tree (MST) of a given graph.static MinimumSpanningTree.Builder
newBuilder()
Create a new minimum spanning tree algorithm builder.
-
-
-
Method Detail
-
computeMinimumSpanningTree
MinimumSpanningTree.Result computeMinimumSpanningTree(Graph g, WeightFunction w)
Compute the minimum spanning tree (MST) of a given graph.- Parameters:
g
- a graphw
- an edge weight function- Returns:
- a result object containing all the edges of the computed spanning tree, which there are \(n-1\) of them (or less, forming a forest if the graph is not connected)
-
newBuilder
static MinimumSpanningTree.Builder newBuilder()
Create a new minimum spanning tree algorithm builder.This is the recommended way to instantiate a new
MinimumSpanningTree
object.- Returns:
- a new builder that can build
MinimumSpanningTree
objects
-
-