Package com.jgalgo.alg.tree
Class TreePathMaximaAbstract
java.lang.Object
com.jgalgo.alg.tree.TreePathMaximaAbstract
- All Implemented Interfaces:
TreePathMaxima
- Direct Known Subclasses:
TreePathMaximaHagerup
Abstract class for TPM computations.
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
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.jgalgo.alg.tree.TreePathMaxima
TreePathMaxima.IQueries, TreePathMaxima.IResult, TreePathMaxima.Queries<V,
E>, TreePathMaxima.Result<V, E> -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription<V,
E> TreePathMaxima.Result <V, E> computeHeaviestEdgeInTreePaths
(Graph<V, E> tree, WeightFunction<E> w, TreePathMaxima.Queries<V, E> queries) Compute the heaviest edge in multiple tree paths.
-
Constructor Details
-
TreePathMaximaAbstract
public TreePathMaximaAbstract()Default constructor.
-
-
Method Details
-
computeHeaviestEdgeInTreePaths
public <V,E> TreePathMaxima.Result<V,E> computeHeaviestEdgeInTreePaths(Graph<V, E> tree, WeightFunction<E> w, TreePathMaxima.Queries<V, E> queries) Description copied from interface:TreePathMaxima
Compute the heaviest edge in multiple tree paths.The
queries
container contains pairs of vertices, each corresponding to a simple path in the giventree
. For each of these paths, the heaviest edge in the path will be computed.If
g
is anIntGraph
, aTreePathMaxima.IResult
object is returned. In that case, its better to pass aIWeightFunction
asw
, andTreePathMaxima.IQueries
asqueries
to avoid boxing/unboxing.- Specified by:
computeHeaviestEdgeInTreePaths
in interfaceTreePathMaxima
- Type Parameters:
V
- the vertices typeE
- the edges type- Parameters:
tree
- a treew
- an edge weight functionqueries
- a sequence of queries as pairs of vertices, each corresponding to a unique simple path in the tree.- Returns:
- a result object, with a corresponding result edge for each query
-