Package com.jgalgo
Interface MinimumSpanningTree
-
public interface MinimumSpanningTreeMinimum 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 interfaceMinimumSpanningTree.BuilderA builder forMinimumSpanningTreeobjects.static interfaceMinimumSpanningTree.ResultA result object forMinimumSpanningTreecomputation.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description MinimumSpanningTree.ResultcomputeMinimumSpanningTree(Graph g, WeightFunction w)Compute the minimum spanning tree (MST) of a given graph.static MinimumSpanningTree.BuildernewBuilder()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
MinimumSpanningTreeobject.- Returns:
- a new builder that can build
MinimumSpanningTreeobjects
-
-