6 * - node: index -> nodevalue
7 * - arc: (index * index) * edgevalue
9 * How ? matrix ? but no growing array :(
11 * When need index ? Must have an index when can't just use the nodevalue
12 * as a key, cos sometimes may have 2 times the same key, but it must
13 * be 2 different nodes. For instance in a C program 'f(); f();' we want 2
14 * nodes, one per 'f();' hence the index. If each node is different, then
15 * no problem, can omit index.
18 class ['node
, 'edge
] ograph_extended
:
20 method add_node
: 'node
-> 'o
* nodei
21 method add_nodei
: nodei
-> 'node
-> 'o
* nodei
22 method replace_node
: nodei
* 'node
-> 'o
23 method del_node
: nodei
-> 'o
25 method add_arc
: (nodei
* nodei
) * 'edge
-> 'o
26 method del_arc
: (nodei
* nodei
) * 'edge
-> 'o
28 method nodes
: (nodei
, 'node
) Oassoc.oassoc
30 method successors
: nodei
-> (nodei
* 'edge
) Oset.oset
31 method predecessors
: nodei
-> (nodei
* 'edge
) Oset.oset
32 method allsuccessors
: (nodei
, (nodei
* 'edge
) Oset.oset
) Oassoc.oassoc
36 class ['node
, 'edge
] ograph_mutable
:
38 method add_node
: 'node
-> nodei
39 method add_nodei
: nodei
-> 'node
-> unit
40 method replace_node
: nodei
* 'node
-> unit
41 method del_node
: nodei
-> unit
43 method add_arc
: (nodei
* nodei
) * 'edge
-> unit
44 method del_arc
: (nodei
* nodei
) * 'edge
-> unit
46 method nodes
: (nodei
, 'node
) Oassoc.oassoc
48 method successors
: nodei
-> (nodei
* 'edge
) Oset.oset
49 method predecessors
: nodei
-> (nodei
* 'edge
) Oset.oset
50 method allsuccessors
: (nodei
, (nodei
* 'edge
) Oset.oset
) Oassoc.oassoc
55 nodei
-> (nodei
-> unit) -> ('node
, 'edge
) ograph_mutable
-> unit
57 val dfs_iter_with_path
:
58 nodei
-> (nodei
-> nodei list
-> unit) -> ('node
, 'edge
) ograph_mutable
->
61 val print_ograph_mutable_generic
:
62 ('node
, 'edge
) ograph_mutable
->
63 string option -> (* label for the entire graph *)
64 (* what string to print for a node and how to color it *)
65 ((nodei
* 'node
) -> (string * string option * string option)) ->
66 output_file
:filename
->
71 val print_ograph_extended
:
72 ('node
* string, 'edge
) ograph_extended
->
73 filename
(* output file *) ->
74 bool (* launch gv ? *) ->
77 val print_ograph_mutable
:
78 ('node
* string, 'edge
) ograph_mutable
->
79 filename
(* output file *) ->
80 bool (* launch gv ? *) ->