| 1 |
(* |
| 2 |
* Some simple routines for performing depth first search. |
| 3 |
* |
| 4 |
* -- Allen |
| 5 |
*) |
| 6 |
|
| 7 |
signature GRAPH_DEPTH_FIRST_SEARCH = |
| 8 |
sig |
| 9 |
|
| 10 |
(* depth first search *) |
| 11 |
|
| 12 |
val dfs : ('n,'e,'g) Graph.graph -> |
| 13 |
(Graph.node_id -> unit) -> |
| 14 |
('e Graph.edge -> unit) -> |
| 15 |
Graph.node_id list -> unit |
| 16 |
|
| 17 |
val dfsfold : ('n,'e,'g) Graph.graph -> |
| 18 |
(Graph.node_id * 'a -> 'a) -> |
| 19 |
('e Graph.edge * 'b -> 'b) -> |
| 20 |
Graph.node_id list -> 'a * 'b -> 'a * 'b |
| 21 |
val dfsnum : ('n,'e,'g) Graph.graph -> |
| 22 |
Graph.node_id list -> |
| 23 |
{ dfsnum : int Array.array, (* dfs numbering *) |
| 24 |
compnum : int Array.array (* completion time *) |
| 25 |
} |
| 26 |
|
| 27 |
(* preorder/postorder numbering *) |
| 28 |
val preorder_numbering : ('n,'e,'g) Graph.graph -> int -> int Array.array |
| 29 |
val postorder_numbering : ('n,'e,'g) Graph.graph -> int -> int Array.array |
| 30 |
|
| 31 |
end |
| 32 |
|