1signature ImplicitGraph = 2sig 3 4 type 'a graph = 'a -> 'a list 5 6 val dfs : 'a graph -> ('a * 'a -> order) -> 7 (int -> 'a -> 'result -> 'result) -> 8 'a -> 'result -> 'result 9 val bfs : 'a graph -> ('a * 'a -> order) -> 10 (int -> 'a -> 'result -> 'result) -> 11 'a -> 'result -> 'result 12 val limdfs : 'a graph -> ('a * 'a -> order) -> 13 (int -> 'a -> 'result -> 'result) -> 14 int -> 'a -> 'result -> 'result 15 val limbfs : 'a graph -> ('a * 'a -> order) -> 16 (int -> 'a -> 'result -> 'result) -> 17 int -> 'a -> 'result -> 'result 18 19(* fold functions get passed distance from root as extra integer parameter. 20 the "lim" versions of the functions will drop visited nodes that have depths 21 greater than the provided limit. In all cases, the initial node is 22 folded into the 'result at depth 0. 23*) 24 25end 26