all_pairs_lowest_common_ancestor(G, pairs=None)
Only defined on non-null directed acyclic graphs.
Uses the $O(n^3)$ ancestor-list algorithm from: M. A. Bender, M. Farach-Colton, G. Pemmasani, S. Skiena, P. Sumazin. "Lowest common ancestors in trees and directed acyclic graphs." Journal of Algorithms, 57(2): 75-94, 2005.
The pairs of nodes of interest. If None, will find the LCA of all pairs of nodes.
Compute the lowest common ancestor for pairs of nodes.
The following pages refer to to this document either explicitly or contain code examples using this.
networkx.algorithms.lowest_common_ancestors.tree_all_pairs_lowest_common_ancestor
networkx.algorithms.lowest_common_ancestors.lowest_common_ancestor
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them