(->MapDependencyGraph dependencies dependents)
Positional factory function for class clojure.tools.namespace.dependency.MapDependencyGraph.
Source
(defrecord MapDependencyGraph [dependencies dependents]
DependencyGraph
(immediate-dependencies [graph node]
(get dependencies node #{}))
(immediate-dependents [graph node]
(get dependents node #{}))
(transitive-dependencies [graph node]
(transitive dependencies #{node}))
(transitive-dependencies-set [graph node-set]
(transitive dependencies node-set))
(transitive-dependents [graph node]
(transitive dependents #{node}))
(transitive-dependents-set [graph node-set]
(transitive dependents node-set))
(nodes [graph]
(clojure.set/union (set (keys dependencies))
(set (keys dependents))))
DependencyGraphUpdate
(depend [graph node dep]
(when (or (= node dep) (depends? graph dep node))
(throw (Exception. (str "Circular dependency between "
(pr-str node) " and " (pr-str dep)))))
(MapDependencyGraph.
(update-in dependencies [node] set-conj dep)
(update-in dependents [dep] set-conj node)))
(remove-edge [graph node dep]
(MapDependencyGraph.
(update-in dependencies [node] disj dep)
(update-in dependents [dep] disj node)))
(remove-all [graph node]
(MapDependencyGraph.
(remove-from-map dependencies node)
(remove-from-map dependents node)))
(remove-node [graph node]
(MapDependencyGraph.
(dissoc dependencies node)
dependents)))