diff options
author | Jeffrey Straszheim <straszheimjeffrey@gmail.com> | 2009-02-24 04:56:19 +0000 |
---|---|---|
committer | Jeffrey Straszheim <straszheimjeffrey@gmail.com> | 2009-02-24 04:56:19 +0000 |
commit | 62f3f77fc90f82dadafbf2971ca0c4c1ee7cdcb7 (patch) | |
tree | eb98583c7f7438c09f0c651dc5235811527d4df7 /src/clojure/contrib/test_contrib/test_graph.clj | |
parent | f4f34fb7112b54ffae63ef166e832b90daaa428c (diff) |
Added component-graph
Diffstat (limited to 'src/clojure/contrib/test_contrib/test_graph.clj')
-rw-r--r-- | src/clojure/contrib/test_contrib/test_graph.clj | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/clojure/contrib/test_contrib/test_graph.clj b/src/clojure/contrib/test_contrib/test_graph.clj index 248203fd..6638fa4c 100644 --- a/src/clojure/contrib/test_contrib/test_graph.clj +++ b/src/clojure/contrib/test_contrib/test_graph.clj @@ -67,6 +67,24 @@ #{#{:h} #{:g} #{:i :j} #{:b :c :a :d :e} #{:f}})) (is (empty? (scc empty-graph)))) +(deftest test-component-graph + (let [cg (component-graph test-graph-2) + ecg (component-graph empty-graph)] + (is (= (:nodes cg) (set (scc test-graph-2)))) + (is (= (get-neighbors cg #{:a :b :c :d :e}) + #{#{:a :b :c :d :e}})) + (is (= (get-neighbors cg #{:g}) + #{#{:a :b :c :d :e} #{:f}})) + (is (= (get-neighbors cg #{:i :j}) + #{#{:i :j}})) + (is (= (get-neighbors cg #{:h}) + #{})) + (is (= ecg empty-graph)))) + +(comment + (run-tests) +) + (deftest test-self-recursive-sets (is (= (set (self-recursive-sets test-graph-2)) |