 (ns clojure.tools.namespace.dependency
   "Bidirectional graphs of dependencies and dependent objects."
+  (:refer-clojure :exclude (keys))
   (:require [clojure.set :as set]))
 
 (defprotocol DependencyGraph

  [graph x y]
  (contains? (transitive-dependents graph x) y))

(comment
  ;; These don't work. You can't implement topological sort using a
  ;; comparison sort.
  (defn topo-comparator
    "Returns a comparator which produces a topographical sort based on
  the dependencies in graph."
    [graph]
    (comparator (partial dependent? graph)))

  (defn topo-sort
    "Returns a topographically-sorted sequence of the items in coll
  using dependencies in graph."  
    [graph coll]
    (sort (topo-comparator graph) coll))

  (defn topo-sort-by
    "Returns a topographically-sorted sequence of the items in coll by
  comparing (keyfn item) using dependencies in graph."
    [graph keyfn coll]
    (sort-by keyfn (topo-comparator graph) coll)))

(comment
  ;; example usage: building a graph like:

    transitively.")
  (transitive-dependents [graph key]
    "Returns the set of all things which depend upon key, directly or
    transitively.")
  (keys [graph]
    "Returns the set of all keys in graph."))

(defprotocol DependencyGraphUpdate
  (depend [graph key dep]
