# Lowest Common Ancestor¶

Algorithms for finding the lowest common ancestor of trees and DAGs.

 all_pairs_lowest_common_ancestor(G[, pairs]) Compute the lowest common ancestor for pairs of nodes. tree_all_pairs_lowest_common_ancestor(G[, …]) Yield the lowest common ancestor for sets of pairs in a tree. lowest_common_ancestor(G, node1, node2[, …]) Compute the lowest common ancestor of the given pair of nodes.