aboutsummaryrefslogtreecommitdiff
path: root/src/clojure
diff options
context:
space:
mode:
Diffstat (limited to 'src/clojure')
-rw-r--r--src/clojure/contrib/graph.clj8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/clojure/contrib/graph.clj b/src/clojure/contrib/graph.clj
index 8e2eda16..f3ca4f3d 100644
--- a/src/clojure/contrib/graph.clj
+++ b/src/clojure/contrib/graph.clj
@@ -76,7 +76,13 @@
(cons n (lazy-walk g (concat (get-neighbors g n) ns) (conj v n))))))))
(defn transitive-closure
- "Returns the transitive closure of a graph. The neighbors are lazily computed."
+ "Returns the transitive closure of a graph. The neighbors are lazily computed.
+
+ Note: some version of this algorithm return all edges a->a
+ regardless of whether such loops exist in the original graph. This
+ version does not. Loops will be included only if produced by
+ cycles in the graph. If you have code that depends on such
+ behavior, call (-> g transitive-closure add-loops)"
[g]
(let [nns (fn [n]
[n (delay (lazy-walk g (get-neighbors g n) #{}))])