7QiF9pQ1oe3J5KgTEKwDII changeset

Changeset323637636337 (b)
Parent393735356538 (a)
ab
55          connected (keep-indexed ; return the nodes connected to the root, and their index
66                     #(let [conn (connected? r %2)]
77                        (if conn [conn %1])) g)
...
8-          candidates (map (fn [[n i]] [(concat (take (dec i) g) (drop i g)) n]) connected)]
8+          candidates (map (fn [[n i]] [(concat (take (dec i) g) (drop i g)) n]) connected)] ; candidates are "new" root nodes, and the remaining graphs
...
99         (or (empty? g)
1010             (and (not (empty? connected))
1111                  (some boolean (map #(apply tour? %) candidates)))))))
...
1
2
3
4
5
6
7
8
9
10
11
--- Revision 393735356538
+++ Revision 323637636337
@@ -6,7 +6,7 @@
connected (keep-indexed ; return the nodes connected to the root, and their index
#(let [conn (connected? r %2)]
(if conn [conn %1])) g)
- candidates (map (fn [[n i]] [(concat (take (dec i) g) (drop i g)) n]) connected)]
+ candidates (map (fn [[n i]] [(concat (take (dec i) g) (drop i g)) n]) connected)] ; candidates are "new" root nodes, and the remaining graphs
(or (empty? g)
(and (not (empty? connected))
(some boolean (map #(apply tour? %) candidates)))))))