                         {: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))))

  (assoc graph
    :succs (:preds graph)
    :preds (:succs graph)
    :ps (:qs graph)
    :qs (:ps graph)
    :layers (vec (rseq (:layers graph)))))


