Macaulay2 » Documentation
Packages » Graphs :: lowestCommonAncestors
next | previous | forward | backward | up | index | toc

# lowestCommonAncestors -- determines the lowest common ancestors between two vertexSet

- Usage:
    `A = lowestCommonAncestors(D,u,v)`
- Inputs:
  - D, a digraph,
  - u, a thing,
  - v, a thing,
- Outputs:
  - A, a list, A list of the lowest common ancestors of u and v

## Description

The lowest common ancestors between two vertexSet are the vertexSet that are ancestors of both u and v and are the shortest distance from the vertexSet in the digraph.

    i1 : D = digraph({{0,1},{0,2},{2,3},{3,4},{4,2}},EntryMode=>"edges");

    i2 : A = lowestCommonAncestors(D,1,3)

    o2 = {0}

    o2 : List

## See also

- reverseBreadthFirstSearch -- runs a reverse breadth first search on the digraph starting at a specified node
- forefathers -- returns the forefathers of a digraph

## Ways to use lowestCommonAncestors:

- `lowestCommonAncestors(Digraph,Thing,Thing)`

## For the programmer

The object lowestCommonAncestors is a method function.

The source of this document is in /build/macaulay2-88fgJW/macaulay2-1.25.11+ds/M2/Macaulay2/packages/Graphs.m2:3835:0.