The following type aliases are used to make type annotations more meaningful.
Basics.Int
( Node
, Node
)
List Node
Represents a directed graph with no cycles.
fromEdges : Set Edge -> Result (List Cycle) AcyclicDigraph
From a directed graph represented as a set of edges, get an
AcyclicDigraph
if the graph has no cycles; otherwise, get a list of all
its simple cycles.
toEdges : AcyclicDigraph -> Set Edge
From an AcyclicDigraph
, get its representation as a set of edges.
topologicalRank : AcyclicDigraph -> Dict Node Basics.Int
Get a dictionary mapping node to topological rank. Rank numbering starts at 1 for all source nodes.
topologicalSortBy : (Node -> comparable) -> Dict Node Basics.Int -> List Node
From topologically-ranked nodes, get a well-ordered list of nodes by
providing a (Node -> comparable)
function to sort same-ranked nodes by.