1616
1717open ! Stdlib
1818
19- module IntSet = Set. Make (struct
20- type t = int
21-
22- let compare = compare
23- end )
24-
2519module Kosaraju : sig
2620 type component_graph =
2721 { sorted_connected_components : int list array
@@ -147,12 +141,6 @@ struct
147141 | Has_loop of Id .t list
148142 | No_loop of Id .t
149143
150- type numbering =
151- { back : int Id.Map .t
152- ; forth : Id .t array
153- }
154- [@@ ocaml.warning "-unused-field" ]
155-
156144 let number graph =
157145 let size = Id.Map. cardinal graph in
158146 let bindings = Id.Map. bindings graph in
@@ -175,10 +163,10 @@ struct
175163 dests
176164 [] )
177165 in
178- { back; forth } , integer_graph
166+ forth, integer_graph
179167
180168 let component_graph graph =
181- let numbering , integer_graph = number graph in
169+ let forth , integer_graph = number graph in
182170 let { Kosaraju. sorted_connected_components; component_edges } =
183171 Kosaraju. component_graph integer_graph
184172 in
@@ -188,11 +176,11 @@ struct
188176 | [] -> assert false
189177 | [ node ] ->
190178 ( (if List. mem ~eq: Int. equal node integer_graph.(node)
191- then Has_loop [ numbering. forth.(node) ]
192- else No_loop numbering. forth.(node))
179+ then Has_loop [ forth.(node) ]
180+ else No_loop forth.(node))
193181 , component_edges.(component) )
194182 | _ :: _ ->
195- ( Has_loop (List. map ~f: (fun node -> numbering. forth.(node)) nodes)
183+ ( Has_loop (List. map ~f: (fun node -> forth.(node)) nodes)
196184 , component_edges.(component) ))
197185 sorted_connected_components
198186
0 commit comments