   (transitive-dependencies g :d)
   ;;=> #{:a :c :b}
 
-  (topo-sort g [:d :a :c :b])
-  ;;=> (:a :b :c :d)
-  )
+  (sort (topo-comparator g) [:d :a :b :foo])
+  ;;=> (:a :b :d :foo)
+
+  ;;      'one    'five
+  ;;        |       |
+  ;;      'two      |
+  ;;       / \      |
+  ;;      /   \     |
+  ;;     /     \   /
+  ;; 'three   'four
+  ;;    |      /
+  ;;  'six    /
+  ;;    |    /
+  ;;    |   /
+  ;;    |  /
+  ;;  'seven
+  ;;
+  (def g2 (-> (graph)
+              (depend 'two 'one)
+              (depend 'three 'two)
+              (depend 'four 'two)
+              (depend 'four 'five)
+              (depend 'six 'three)
+              (depend 'seven 'six)
+              (depend 'seven 'four)))
+
+  (transitive-dependencies g2 'seven)
+  ;;=> #{two four six one five three}
+  
+  (transitive-dependents g2 'five)
+  ;;=> #{four seven}
+
+  (transitive-dependents g2 'two)
+  ;;=> #{four seven six three}
+
+  (topo-sort g2)
+  ;;=> (one two three five six four seven)
+
+  (sort (topo-comparator g2) '[three seven nine eight five])
+  ;;=> (three five seven nine eight)
+)

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

(defprotocol DependencyGraphUpdate
  (depend [graph key dep]

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

(defprotocol DependencyGraph
