(depend graph x)
(depend graph x dep)
(depend graph x dep & more)
Adds to the dependency graph that x depends on deps. Forbids
circular and self-referential dependencies.
Source
(defn depend
"Adds to the dependency graph that x depends on deps. Forbids
circular and self-referential dependencies."
([graph x] graph)
([graph x dep]
(assert (not (depends? graph dep x)) "circular dependency")
(assert (not (= x dep)) "self-referential dependency")
(-> graph
(add-relationship :dependencies x dep)
(add-relationship :dependents dep x)))
([graph x dep & more]
(reduce (fn [g d] (depend g x d))
graph (cons dep more))))