                 classes-set)
         sources (set/difference classes-set (set (keys preds)))
         sinks (set/difference classes-set (set (keys succs)))
-        classes (if (= compacted :up)
+        classes (if (= compaction :up)
                   (let [simple-succs (->> succs
                                           (map (fn [[src edges]]
                                                  [src (set (map #(get-in

                               (get class-edges class))
                  class-y (if (empty? neighbor-ys)
                            0
                            (if (= compacted :up)
                              (+ (apply max neighbor-ys) node-sep)
                              (- (apply min neighbor-ys) node-sep)))]
              (assoc ys class class-y)))
          {}
          classes))


(defrecord ClassGraph [classes block-classes succs preds block-succs
                       block-preds sources sinks aligned compacted]
  YPlottable
  (ys [this node-sep char-sep]
    (let [{:keys [classes block-classes preds succs
                  block-preds block-succs compacted]} this
                  [block-edges class-edges] ({:up [block-preds preds]
                                              :down [block-succs succs]} compacted)
                  rel-ys (reduce #(merge %1 (get-block-rel-ys %2 block-edges
                                                              node-sep char-sep
                                                              compacted))
                                 {}
                                 classes)
                  shift-ys (get-shift-ys classes block-classes class-edges node-sep
                                         char-sep rel-ys compacted)
                  block-shift-ys (into {} (mapcat (fn [[class shift]]
                                                    (map #(-> [% shift]) class))
                                                  shift-ys))]

                 [{} #{}]
                 start-blocks)))

(defn block-info->ClassGraph
  "For a particular blockification, compacts these blocks in to a ClassGraph,
  in either an :up or :down direction"
  [block-info alignment compaction]
  (let [block-keys (if (= compaction :up)
                     [:blocks-up :simple-succs :sources]
                     [:blocks-down :simple-preds :sinks])
        [blocks classify-edges start-blocks] (map block-info block-keys)
