From: Stefano Zacchiroli Date: Thu, 20 Jul 2006 15:02:52 +0000 (+0000) Subject: avoid collapsing node that does not need to be, i.e.: X-Git-Tag: 0.4.95@7852~1168 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=55ae9c989557fbb879104962b0db50b19a9cfd2b;p=helm.git avoid collapsing node that does not need to be, i.e.: - nodes with no outgoing edges - nodes which have not been expanded before --- diff --git a/components/metadata/metadataDeps.ml b/components/metadata/metadataDeps.ml index 0e1dbb817..3247114a2 100644 --- a/components/metadata/metadataDeps.ml +++ b/components/metadata/metadataDeps.ml @@ -205,9 +205,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 =