+(* 0: 7
+ 1: 29
+ 2: 120
+ 3: > 319
+ 4: ???
+*)
+
type t = M | I | C
type w = t list
type eqclass = w list
(List.map
(function w ->
List.map (fun x -> x@w)
- (if List.length (List.filter (fun w -> w = M) w) >= 2 then
+ (if List.length (List.filter (fun w -> w = M) w) >= 1 then
[[I];[C];[]]
else
[[I];[C];[M];[]])
if c = 0 then String.compare s1 s2 else c
;;
-let normalize_and_describe norm mk_vertex dsc_vertex =
+let normalize_and_describe norm dsc_vertex =
let cache = Hashtbl.create 5393 in
let canonicals = Hashtbl.create 5393 in
let descriptions = Hashtbl.create 5393 in
- (function n ->
- let v = mk_vertex n in
+ (function v ->
let normalized = norm v in
let dsc = dsc_vertex v in
if not (List.mem dsc (Hashtbl.find_all cache normalized)) then
print_endline (string_of_int (List.length arcs) ^ " arcs to be classified");
let mk_vertex,dsc_vertex = mk_vertex_and_dsc_vertex () in
let graph = Graph.Pack.Digraph.create () in
- iteri
- (fun (x,y) ->
- Graph.Pack.Digraph.add_edge graph (mk_vertex x) (mk_vertex y)) arcs;
+ let varcs = mapi (fun (x,y) -> mk_vertex x,mk_vertex y) arcs in
+ iteri (fun (x,y) -> Graph.Pack.Digraph.add_edge graph x y) varcs;
print_endline ("<scc>");
let classes,norm = Graph.Pack.Digraph.Components.scc graph in
print_endline (string_of_int classes ^ " classes");
print_endline ("-----");
- norm,mk_vertex,dsc_vertex,arcs
+ norm,dsc_vertex,varcs
;;
-let analyze (norm,mk_vertex,dsc_vertex,arcs) =
+let analyze (norm,dsc_vertex,arcs) =
print_endline ("building class graph (" ^ string_of_int (List.length arcs) ^ ")");
let normalize,finish,describe =
- normalize_and_describe norm mk_vertex dsc_vertex in
+ normalize_and_describe norm dsc_vertex in
let arcs =
uniq (mapi (fun (x,y) -> normalize x,normalize y) arcs) in
let cgraph = Graph.Pack.Digraph.create () in
else
analyze pkg
in
- iter 10 [[]]
+ iter 6 [[]]
;;