Package com.jgalgo.alg.span
Class MinimumDirectedSpanningTreeAbstract
java.lang.Object
com.jgalgo.alg.span.MinimumDirectedSpanningTreeAbstract
- All Implemented Interfaces:
MinimumDirectedSpanningTree
- Direct Known Subclasses:
MinimumDirectedSpanningTreeTarjan
public abstract class MinimumDirectedSpanningTreeAbstract
extends Object
implements MinimumDirectedSpanningTree
Abstract class for computing minimum spanning trees in directed graphs.
The class implements the interface by solving the problem on the index graph and then maps the results back to the original graph. The implementation for index graphs is abstract and left to the subclasses.
- Author:
- Barak Ugav
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription<V,
E> MinimumSpanningTree.Result <V, E> computeMinimumDirectedSpanningTree
(Graph<V, E> g, WeightFunction<E> w, V root) Compute a minimum directed spanning tree (MDST) in a directed graph, rooted at the given vertex.
-
Constructor Details
-
MinimumDirectedSpanningTreeAbstract
public MinimumDirectedSpanningTreeAbstract()Default constructor.
-
-
Method Details
-
computeMinimumDirectedSpanningTree
public <V,E> MinimumSpanningTree.Result<V,E> computeMinimumDirectedSpanningTree(Graph<V, E> g, WeightFunction<E> w, V root) Description copied from interface:MinimumDirectedSpanningTree
Compute a minimum directed spanning tree (MDST) in a directed graph, rooted at the given vertex.Note that the returned spanning tree is a single tree that span only the vertices reachable from the root, and not a forest that span the whole graph.
If
g
is anIntGraph
, aMinimumSpanningTree.IResult
object will be returned. In that case, its better to pass aIWeightFunction
asw
to avoid boxing/unboxing.- Specified by:
computeMinimumDirectedSpanningTree
in interfaceMinimumDirectedSpanningTree
- Type Parameters:
V
- the vertices typeE
- the edges type- Parameters:
g
- a directed graphw
- an edge weight functionroot
- vertex in the graph the spanning tree will be rooted from- Returns:
- all edges composing the spanning tree
-