Package com.jgalgo.alg.tree
Class LowestCommonAncestorOfflineAbstract
java.lang.Object
com.jgalgo.alg.tree.LowestCommonAncestorOfflineAbstract
- All Implemented Interfaces:
LowestCommonAncestorOffline
- Direct Known Subclasses:
LowestCommonAncestorOfflineUnionFind
public abstract class LowestCommonAncestorOfflineAbstract
extends Object
implements LowestCommonAncestorOffline
Abstract class for offline LCA computation.
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.LowestCommonAncestorOffline
LowestCommonAncestorOffline.IQueries, LowestCommonAncestorOffline.IResult, LowestCommonAncestorOffline.Queries<V,
E>, LowestCommonAncestorOffline.Result<V, E> -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription<V,
E> LowestCommonAncestorOffline.Result <V, E> findLowestCommonAncestors
(Graph<V, E> tree, V root, LowestCommonAncestorOffline.Queries<V, E> queries) Find the lowest common ancestors of the given queries.
-
Constructor Details
-
LowestCommonAncestorOfflineAbstract
public LowestCommonAncestorOfflineAbstract()Default constructor.
-
-
Method Details
-
findLowestCommonAncestors
public <V,E> LowestCommonAncestorOffline.Result<V,E> findLowestCommonAncestors(Graph<V, E> tree, V root, LowestCommonAncestorOffline.Queries<V, E> queries) Description copied from interface:LowestCommonAncestorOffline
Find the lowest common ancestors of the given queries.If
g
isIntGraph
, the returned object isLowestCommonAncestorOffline.IResult
.- Specified by:
findLowestCommonAncestors
in interfaceLowestCommonAncestorOffline
- Type Parameters:
V
- the vertices typeE
- the edges type- Parameters:
tree
- the treeroot
- the root of the treequeries
- the queries- Returns:
- the lowest common ancestors of the given queries
-