                  (let [[nv comp] (post-ordered-visit rev
                                                      (first stack)
                                                      [visited #{}])
-                       ns (doall (remove nv stack))] ;doall prevents StackOverflow
+                       ns (doall (remove nv stack))]        ;doall prevents StackOverflow
                    (recur ns nv (conj acc comp)))))]
     (step po #{} [])))
 

  "For each node n, add the edge n->n if not already present."
  [g]
  (make-directed-graph
          (nodes g)
          (into {} (map (fn [n]
                          [n (conj (set (get-neighbors g n)) n)]) (nodes g)))))

(defn remove-loops
  "For each node n, remove any edges n->n."
  [g]
  (make-directed-graph
          (nodes g)
          (into {} (map (fn [n]
                          [n (disj (set (get-neighbors g n)) n)]) (nodes g)))))


;; Graph Walk

;; and more modifications for use with loom/ubergraph

(ns
  #^{:author "Jeffrey Straszheim",
     :doc    "Basic graph theory algorithms"}
  conexp.util.graph
  (:require [ubergraph.core :as uber]
            [loom.graph :as lg])
