]> matita.cs.unibo.it Git - helm.git/blobdiff - components/metadata/metadataDeps.ml
Demodulate_tac now depends on the universe
[helm.git] / components / metadata / metadataDeps.ml
index 3247114a2e5489e5528d8301d86ef5c5c2438487..f2b1d049644cb72e589e5f86a6a8d4e2c9c74c80 100644 (file)
@@ -91,6 +91,16 @@ let inverse_deps ~dbd uri =
   do_query (MetadataTypes.obj_tbl ())
     @ do_query MetadataTypes.library_obj_tbl
 
+let topological_sort ~dbd uris =
+ let module OrderedUri =
+  struct
+   type t = UriManager.uri
+   let compare = UriManager.compare
+  end in
+ let module Topo = HTopoSort.Make(OrderedUri) in
+  Topo.topological_sort uris
+   (fun uri -> fst (List.split (direct_deps ~dbd uri)))
+
 module DepGraph =
 struct
   module UriTbl = UriManager.UriHashtbl
@@ -98,7 +108,10 @@ struct
   let fat_value = 20
   let fat_increment = fat_value
   let incomplete_attrs = ["style", "dashed"]
-  let global_node_attrs = ["fontsize", "9"; "width", ".4"; "height", ".4"]
+  let global_node_attrs = ["fontsize", "12"; "width", ".4"; "height", ".4"]
+
+  let label_of_uri uri = UriManager.name_of_uri uri
+  (*let label_of_uri uri = UriManager.string_of_uri uri*)
 
   type neighborhood =
     { adjacency: UriManager.uri list lazy_t;  (* all outgoing edges *)
@@ -129,7 +142,7 @@ struct
         (*eprintf "Node '%s' not found.\n" (UriManager.string_of_uri uri);*)
         assert false
     in
-    Pp.header ~graph_attrs:["rankdir", "LR"] ~node_attrs:global_node_attrs fmt;
+    Pp.header ~graph_type:"strict digraph" ~graph_attrs:["rankdir", "LR"] ~node_attrs:global_node_attrs fmt;
     let rec aux =
       function
         | [] -> ()
@@ -137,7 +150,7 @@ struct
             let suri = UriManager.string_of_uri uri in
             Pp.node suri
               ~attrs:([ "href", UriManager.string_of_uri uri;
-                       (*"label", UriManager.name_of_uri uri*)
+                        "label", label_of_uri uri
                 ] @ (if is_complete uri then [] else incomplete_attrs))
               fmt;
             let new_nodes = ref [] in