   from last-node to r node"
   (let [r-layer-id (inc (:layer-id last-node))
         [r-g r-node] (make-node graph r-layer-id {:characters characters})
-        g (-> r-g
-              (update-in [:rs] conj r-node)
+        g (-> (update-in r-g [:rs] conj r-node)
               (add-edge last-node r-node characters))]
     [g r-node]))
 

    (if (< num-succs 2)
      0
      (let [measures (:measures next-layer)
            order-map (->> succs
                           (sort-by #(get measures %))
                           (map-indexed (fn [idx n]
                                          (map #(-> [% idx])
                                               (:characters n))))

  of [order edge] pairs of the edge targets in the destination layer, using
  this edge ordering"
  [ordered next-ordered graph-edges]
  (let [next-order-map (->> (map-indexed #(-> [%2 %1]) next-ordered)
                            (into {}))
        ;; Edges between segment containers need to be counted as well
        ;; but they change with each new ordering, so we just temporarily
        ;; merge the current segment edges with the never-changing
        ;; node -> node edges
        edges (->> (filter vector? next-ordered)
                   (map (juxt identity
                              (partial mapcat #(-> % :characters))))
                   (map (fn [[seg-c characters]]
