V
 the graph vertex typeE
 the graph edge typepublic class TarjanLowestCommonAncestor<V,E> extends Object
Modifier and Type  Class and Description 

static class 
TarjanLowestCommonAncestor.LcaRequestResponse<V>
Data transfer object for LCA request and response.

Constructor and Description 

TarjanLowestCommonAncestor(Graph<V,E> g)
Create an instance with a reference to the graph that we will find LCAs for

Modifier and Type  Method and Description 

List<V> 
calculate(V start,
List<TarjanLowestCommonAncestor.LcaRequestResponse<V>> lrr)
Calculate the LCM's between a set of pairs (
a and
b ) treating start as the root we want to search from, and setting the LCA
of each pair in its LCA field. 
V 
calculate(V start,
V a,
V b)
Calculate the LCM between
a and b treating start as
the root we want to search from. 
public V calculate(V start, V a, V b)
a
and b
treating start
as
the root we want to search from.start
 the root of subtreea
 the first vertexb
 the second vertexpublic List<V> calculate(V start, List<TarjanLowestCommonAncestor.LcaRequestResponse<V>> lrr)
a
and
b
) treating start
as the root we want to search from, and setting the LCA
of each pair in its LCA field.start
 the root of the subtreelrr
 a list of requestsresponse objects. The answer if stored on these objects at the
LCA field.Copyright © 2018. All rights reserved.