LowestCommonAncestors

overflowdb.algorithm.LowestCommonAncestors$

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Concise view

Value members

Concrete methods

def apply[A : GetParents](nodes: Set[A]): Set[A]

Find the lowest common ancestor(s) for a set of nodes in a directed acyclic graph (DAG).

Find the lowest common ancestor(s) for a set of nodes in a directed acyclic graph (DAG).

Attributes

Returns:

Set.empty if given nodes have cyclic dependencies Algorithm: 1) for each relevant node, find their recursive parents 2) create the intersection of all of those sets 3) the LCA are those nodes, that do not have any children in that set based on https://www.baeldung.com/cs/lowest-common-ancestor-acyclic-graph

def parentsRecursive[A : GetParents](node: A): Set[A]