                         {:layers []
                          :succs {}
                          :preds {}
-                         :p #{}
-                         :q #{}
-                         :r #{}
+                         :ps #{}
+                         :qs #{}
+                         :rs #{}
                          :marked #{}
                          :last-nodes-by-character {}
                          :last-nodes-by-node {}}))

(defn- set-qs-non-qs
  "ESK requires a layer's nodes to be split into lists of q-nodes and non-q-nodes"
  [graph layer]
  (->> ((juxt filter remove) #(contains? (:q graph) %) (:nodes layer))
       (map set)
       (interleave [:qs :non-qs])
       (apply (partial assoc layer))))

        r-node (make-node graph r-layer-id {:characters characters})
        g (-> graph
              (update-in [:layers r-layer-id :nodes] conj r-node)
              (update-in [:rs] conj r-node)
              (add-edge last-node r-node characters))]
    [g r-node]))

