]> matita.cs.unibo.it Git - helm.git/blobdiff - components/metadata/metadataDeps.ml
new problem:
[helm.git] / components / metadata / metadataDeps.ml
index 0e1dbb817c45ef39bf8de27a43d81bab315bf13c..91fa8004ca14ae49694c98209a751ffb765d2f2b 100644 (file)
@@ -98,7 +98,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 *)
@@ -137,7 +140,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
@@ -205,9 +208,16 @@ struct
       [], 0
 
   let collapse uri (adjlist, _root, f, _invert) =
+    try
+      let neighbs = UriTbl.find adjlist uri in
+      if Lazy.lazy_is_val neighbs.adjacency then
+        (* do not collapse already collapsed nodes *)
+        if Lazy.force neighbs.adjacency <> [] then
+          (* do not collapse nodes with no outgoing edges *)
+          UriTbl.replace adjlist uri { adjacency = lazy (f uri); shown = 0 }
+    with Not_found ->
       (* do not add a collapsed node if it was not part of the graph *)
-    if UriTbl.mem adjlist uri then
-      UriTbl.replace adjlist uri { adjacency = lazy (f uri); shown = 0 }
+      ()
 
   let graph_of_fun ?(invert = false) f ~dbd uri =
     let f ~dbd uri =