`module type G = sig ... end`

Minimal graph signature for the algorithm

`type 'a element =`

1. `| Vertex of 'a`
2. `| Component of 'a * 'a t`

The type of the elements of a weak topological ordering over a set of `'a`.

- `Vertex v` represents a single vertex.
- `Component (head, cs)` is a component of the wto, that is a sequence of elements between two parentheses. `head` is the head of the component, that is the first element, which is guaranteed to be a vertex by definition. `cs` is the rest of the component.

`and 'a t`

The type of a sequence of outermost elements in a weak topological ordering. This is also the type of a weak topological ordering over a set of `'a`.

`val fold_left : ('a -> 'b element -> 'a) -> 'a -> 'b t -> 'a`

Folding over the elements of a weak topological ordering. They are given to the accumulating function according to their order.

Note that as `element`s present in an ordering of type `t` can contain values of type `t` itself due to the `Component` variant, this function should be used by defining a recursive function `f`, which will call `fold_left` with `f` used to define the first parameter.

`module Make (G : G) : sig ... end`