 
 (defn dim [ds] (dec (count (indices ds))))
 
-(defn pretty-traversal [ds indices seeds]
+(defn complete? [ds]
+  (and (every? (comp not nil?)
+               (for [i (indices ds), D (elements ds)]
+                 (s ds i D)))
+       (every? (comp not nil?)
+               (for [i (indices ds), j (indices ds), D (elements ds)]
+                 (v ds i j D)))))
+
+(defn traversal [ds indices seeds]
   (let [stacks (map #(vector % ()) (take 2 indices))
         queues (map #(vector % empty-queue) (drop 2 indices))
         as-root #(vector % :root %)

                           head (if (= i :root) [-1] [(imap i) Ei])
                           tail (if new? (spins D) [])]
                       (concat head [E] tail (step xs emap n)))))))]
    (step traversal {} 1)))

(defn invariant [ds]
  (do


(defn orbit-reps
  ([ds indices seeds]
    (for [[D i] (traversal ds indices seeds) :when (= :root i)] D))
  ([ds indices]
    (orbit-reps ds indices (elements ds))))

(defn orbit [ds indices seed]
  (distinct (for [[D i] (traversal ds indices [seed])] D)))

(defn connected? [ds]
  (> 2 (count (orbit-reps ds (indices ds)))))

(defn partial-orientation [ds]
  (loop [ori {}
         [[Di i D] & xs] (traversal ds (indices ds) (elements ds))]
    (cond (nil? i) ori
          (or (nil? D) (ori D)) (recur ori xs)
          :else (recur (assoc ori D (if (= :root i) 1 (- (ori Di)))) xs))))

(defn- protocol [ds indices trav]
  (let [imap (zipmap indices (range (count indices)))
        ipairs (map vector indices (rest indices))
        spins (fn [D] (for [[i j] ipairs] (or (v ds i j D) 0)))
