aboutsummaryrefslogtreecommitdiff
path: root/src/clojure/contrib/graph.clj
diff options
context:
space:
mode:
authorJeffrey Straszheim <straszheimjeffrey@gmail.com>2009-02-24 04:13:52 +0000
committerJeffrey Straszheim <straszheimjeffrey@gmail.com>2009-02-24 04:13:52 +0000
commitf4f34fb7112b54ffae63ef166e832b90daaa428c (patch)
treecea5425d1932cfe996ad5409f3ccb8ddd32659cf /src/clojure/contrib/graph.clj
parentfdb9b1fb7b00eb5b813c5298c90261841261c227 (diff)
Fixed more comments
Diffstat (limited to 'src/clojure/contrib/graph.clj')
-rw-r--r--src/clojure/contrib/graph.clj17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/clojure/contrib/graph.clj b/src/clojure/contrib/graph.clj
index c5128306..1979c0db 100644
--- a/src/clojure/contrib/graph.clj
+++ b/src/clojure/contrib/graph.clj
@@ -81,9 +81,9 @@
"Returns, as a sequence of sets, the components of a graph that are
self-recursive."
[g]
- (let [recursive? (fn [n]
- (or (> (count n) 1)
- (some n (get-neighbors g (first n)))))]
+ (let [recursive? (fn [ns]
+ (or (> (count ns) 1)
+ (some ns (get-neighbors g (first ns)))))]
(filter recursive? (scc g))))
@@ -113,10 +113,11 @@
priorities)))
(defn dependency-list
- "Similar to a topological sort, this returns a vector of sets, each
- a set of nodes that depend on the earlier nodes in the vector.
- Assume the input graph (which much be acyclic) has an edge a->b
- when a depend on b."
+ "Similar to a topological sort, this returns a vector of sets. The
+ set of nodes at index 0 are independent. The set at index 1 depend
+ on index 0; those at 2 depend on 0 and 1, and so on. Those withing
+ a set have no mutual dependencies. Assume the input graph (which
+ much be acyclic) has an edge a->b when a depends on b."
[g]
(let [step (fn [d]
(let [update (fn [n]
@@ -149,4 +150,4 @@
(fold-into-sets counts)))
-;; End of file \ No newline at end of file
+;; End of file