Packages

o

overflowdb.algorithm

LowestCommonAncestors

object LowestCommonAncestors

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. LowestCommonAncestors
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Value Members

  1. def apply[A](nodes: Set[A])(implicit arg0: GetParents[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).

    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

  2. def parentsRecursive[A](node: A)(implicit arg0: GetParents[A]): Set[A]