 (defprotocol Reversible
   (rev [item] "It... reverses"))
 
+(defprotocol Flippable
+  (flip [item] "Flips a graph along the axis perpendicular to the layers, so
+                that nodes and edges within a layer reverse their order"))
 
 (defrecord Node [id layer-id characters weight])
 

    (map->FlatGraph {:layers layers
                     :succs (:succs cm-graph)
                     :preds (:preds cm-graph)
                     :marked (:marked cm-graph)
                     :aboves aboves
                     :belows belows
                     :top-idxs top-idxs
                     :bot-idxs bot-idxs})))


(defn check-alignment


(defrecord OrderedLayer [id duration items])
(defrecord CountedAndMarkedGraph [layers succs preds crossings marked]) ; still has OrderedLayers
(defrecord FlatGraph [layers succs preds aboves belows top-idxs bot-idxs crossings marked]
  Reversible
  (rev [this]
    (assoc this
      :succs preds
      :preds succs
      :layers (vec (rseq layers))))
  Flippable
  (flip [this]
    (assoc this
      :aboves belows
      :belows aboves
      :top-idxs bot-idxs
      :bot-idxs top-idxs)))

(defrecord FlatLayer [id duration items])
(defrecord BlockGraph [blocks succs sources])
(defrecord BlockEdge [src dest weight])
