object DependencySequencer
Linear Supertypes
Ordering
- Alphabetic
- By Inheritance
Inherited
- DependencySequencer
- AnyRef
- Any
- Hide All
- Show All
Visibility
- Public
- Protected
Value Members
- def apply[A](nodes: Set[A])(implicit arg0: GetParents[A]): Seq[Set[A]]
Find the sequence of dependencies a set of nodes in a directed acyclic graph (DAG).
Find the sequence of dependencies a set of nodes in a directed acyclic graph (DAG). Sample use case: concurrent task processing: given a set of tasks, determine which ones can be executed in parallel, and which ones need to run in sequence.
- Exceptions thrown
java.lang.AssertionError
if given nodes have cyclic dependencies Algorithm: variant of Kahn's algorithm for topological sort 1) for given nodes, find all leaves, i.e. the those without parents (e.g. task dependencies) 2) disregard all that have already been visited and add to the results sequence 3) repeat for the remainder of nodes see https://en.wikipedia.org/wiki/Topological_sorting#Kahn%27s_algorithm