   [out
    {::keys [branch-type] :as env}
    {::keys [node-id] :as node}
-   branch-node]
+   branch-node-factory]
   (if node-id
     (let [root-node (get-root-node out)
           next-node (get-node out node-id)]

        (assoc ::run-next run-next)))))

(defn extend-resolver-run-next
  "Extend "
  [{::keys [index-syms] :as out}
   {::keys [run-next run-next-trail] :as env}]
  (if run-next

            (conj visited node-id))
          out)))))

(defn remove-node
  "Remove a node from the graph. In case of resolver nodes it also removes them
  from the ::index-syms."
  [out {::keys [node-id]}]
  (let [node (get-node out node-id)]
    (-> out
        (update-in [::index-syms (pc-sym node)] disj node-id)
        (update ::nodes dissoc node-id))))

(defn merge-node-requires
  "Merge requires from node into target-node-id."
  [out target-node-id {::keys [requires]}]
  (update-in out [::nodes target-node-id ::requires] merge-io requires))

(defn merge-node-provides
  "Merge provides from node into target-node-id."
  [out target-node-id {::keys [provides]}]
  (update-in out [::nodes target-node-id ::provides] merge-io provides))

(defn collapse-dynamic-nodes
