        commit-graph->nodes
        distinct-nodes
        nodes->order
-       find-merge-links)
+       find-merge-links
+       nodes->links)
 
   )

           (into {})))))



(comment


    (assoc cg
      :nodes
      (->> new-nodes
           (map (fn [[k v]] [k (vec (rest v))]))
           (into {}))
      :branch-links
      (->> new-nodes
           (map (fn [[k v]] [k (if (nil? (first v))
                                nil
                                (vec (take 2 v)))]))
           (into {})))))


(defn find-merge-links [{:keys [causal-order branches] :as cg}]
  (let [branch-heads (into {} (map (fn [[k v]] [v k]) branches))]
    (assoc cg :merge-links
      (->> causal-order
           (filter-map [key val] (> (count val) 1))
           (into {})
