Class TreePathMaximaAbstract

java.lang.Object
com.jgalgo.alg.tree.TreePathMaximaAbstract
All Implemented Interfaces:
TreePathMaxima
Direct Known Subclasses:
TreePathMaximaHagerup

public abstract class TreePathMaximaAbstract extends Object implements TreePathMaxima
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
  • 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 given tree. For each of these paths, the heaviest edge in the path will be computed.

      If g is an IntGraph, a TreePathMaxima.IResult object is returned. In that case, its better to pass a IWeightFunction as w, and TreePathMaxima.IQueries as queries to avoid boxing/unboxing.

      Specified by:
      computeHeaviestEdgeInTreePaths in interface TreePathMaxima
      Type Parameters:
      V - the vertices type
      E - the edges type
      Parameters:
      tree - a tree
      w - an edge weight function
      queries - 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