          (map
           (fn [[k v]]
             [k
-             (map
+             (mapv
               (fn [i]
                 [(get v i) (get v (inc i))])
               (range (count v)))])))))
+
+
+(defn explore-commit-graph
+  "Run the pipeline"
+  [cg]
+  (->> cg
+       commit-graph->nodes
+       distinct-nodes
+       nodes->order
+       find-merge-links
+       nodes->links))
 
 (comment
 

(ns signet.graph
  (:require [clojure.set :refer [difference]]
            [aprint.core :refer [aprint]]))


(defmacro filter-map [bindings pred m]
  `(select-keys ~m
                (for [~bindings ~m
                      :when ~pred]
                  ~(first bindings))))


(defn branches->nodes [c causal-order heads]

(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
      (->> (select-keys causal-order
                (for [[k v] causal-order
                      :when (> (count v) 1)]
                  k))
           (into {})
           (map (fn [[k v]] (map (fn [b] [b [(branches b) k]]) (remove nil? (map branch-heads v)))))
           (apply concat)
