Module SCC.Run

The algorithm runs when Run(G) is called. The time complexity of the computation is O(V+E), where V is the number of vertices of the graph G and E is the number of its edges.

Parameters

module G : sig ... end

Signature

val representative : G.node -> G.node

representative maps each node to a representative element of its component.

val scc : G.node -> G.node list

scc maps the representative element of a component to a list of all members of this component. It maps a non-representative element to the empty list.

val iter : (G.node -> G.node list -> unit) -> unit

iter yield enumerates all components. For each component, the function yield is applied to this component's representative element and to a list of the component's elements. (This must be a nonempty list.) The components are enumerated in topological order: that is, a component is examined before its successors are examined.

val rev_topological_iter : (G.node -> G.node list -> unit) -> unit

rev_topological_iter yield enumerates all components. For each component, the function yield is applied to this component's representative element and to a list of the component's elements. (This must be a nonempty list.) The components are enumerated in reverse topological order: that is, a component is examined after its successors have been examined.

val map : (G.node -> G.node list -> 'a) -> 'a list

Like iter, map yield enumerates all components, in topological order. A list of the results produced by each invocation of yield is returned.

val rev_map : (G.node -> G.node list -> 'a) -> 'a list

like rev_topological_iter, rev_map yield enumerates all components, in reverse topological order. It produces a list of results in topological order. That is, in comparison with map, the order of the traversal differs, but the order of the results in the result list is the same.