xfrp/topsort

    Dark Mode
Search:
Group by:

Generic topological sorting algorithm.

Types

ReferencesOf[T] = (proc (x: T): seq[T] {...}{.noSideEffect.})
  Source Edit
ReferenceGraph[T] = tuple[domain: seq[T], ## Nodes.
                          referencesOf: ReferencesOf[T]]
Directed Acyclic Graph (DAG).   Source Edit

Funcs

func getAnyReferenceCycle[T](graph: ReferenceGraph[T]): seq[T]
Check if the reference graph has any cycles. If a cycle is found, then return it (result.len > 0).   Source Edit
func topologicallySorted[T](graph: ReferenceGraph[T]; initVisited: seq[T] = @[]): seq[
    T]
Apply topological sorting for the given graph. You should check the graph has no cycle before calling it.   Source Edit