Module Topological_sort
include Topological_sort__.Topological_sort_intf.Topological_sort
module type Node = Topological_sort__.Topological_sort_intf.Node
module Edge : sig ... end
val sort : ?verbose:Topological_sort__.Import.bool -> (module Node with type t = 'node) -> 'node Topological_sort__.Import.list -> 'node Edge.t Topological_sort__.Import.list -> 'node Topological_sort__.Import.list Topological_sort__.Import.Or_error.t
sort (module Node) nodes edges
returns a list of nodesoutput
satisfying:- every node that appears in
nodes
oredges
occurs once inoutput
. - if
{ from; to_ }
is inedges
, thenfrom
occurs beforeto_
inoutput
. - nodes that have no incoming or outgoing edges appear sorted at the end of
output
.
sort
returnsError
if there is a cycle.- every node that appears in