module Graph:Graph operations. This module is similar to the graph library module common in Prolog systems.sig
..end
The P-representation of a graph is a list of (from, to) vertex pairs, where the pairs can be in any old order.
The S-representation of a graph is a list of (vertex, neighbours)
pairs, where the pairs are ordered according to their vertex and
the neighbours of each vertex are also orderered.
Structural equality (i.e. =
) and Pervasives.compare
are used
for identity and comparison of vertices.
type'a
p_graph =('a * 'a) list
type'a
s_graph =('a * 'a list) list
val p_to_s_graph : 'a p_graph -> 'a s_graph
val s_to_p_graph : 'a s_graph -> 'a p_graph
val p_transpose : 'a p_graph -> 'a p_graph
val warshall : 'a s_graph -> 'a s_graph
val top_sort : 'a s_graph -> 'a list
Not_found
if the graph is cyclic.