org.jgrapht.alg

## Class TarjanLowestCommonAncestor<V,E>

- java.lang.Object
- - org.jgrapht.alg.TarjanLowestCommonAncestor<V,E>

-     public class TarjanLowestCommonAncestor<V,E>
      extends Object

  Used to calculate Tarjan's Lowest Common Ancestors Algorithm
  Author:
    Leo Crawford

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `TarjanLowestCommonAncestor.LcaRequestResponse<V>`

  - ### Constructor Summary

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

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `List<V>` | `calculate(V start, List<TarjanLowestCommonAncestor.LcaRequestResponse<V>> lrr)` Calculate the LCMs 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.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### TarjanLowestCommonAncestor

          public TarjanLowestCommonAncestor(Graph<V,E> g)

      Create an instance with a reference to the graph that we will find LCAs for

  - ### Method Detail

    - #### calculate

          public 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.

    - #### calculate

          public List<V> calculate(V start,
                          List<TarjanLowestCommonAncestor.LcaRequestResponse<V>> lrr)

      Calculate the LCMs 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

Copyright © 2016. All rights reserved.