    {:class "clickable"
     :id id
     :d (make-line-dirs from to)
-    :stroke color
+    :stroke (name color)
     :stroke-width "10px"
     :fill "none"
     :marker-start "url(#Vertex)"



(defn make-edges [{:keys [vertices edges]}]
  (vertex-id->points edges vertices))


(defn make-svg [[width height] edges]

                                (make-svg [1000 1000]
                                          (make-edges world-state))])))

(defn ok-to-flip? [{:keys [vertices edges]} [left right color]]
  (let [this-value (color->value color)
        entering-right (filter #(= right (second (second %))) edges)
        sum-into-right (apply + (map #(color->value ((second %) 2)) entering-right))
        right-value (first (vertices right))]
    (if (< (- sum-into-right this-value) right-value)
      false
      true)))

(defn flip-edge [world-state [left right color :as edge]]
  (if (ok-to-flip? world-state edge)
    [right left color]
    edge))


(defn update-state [event world-state]
  (let [clicked-what (event->targetid event)
        constrained-flip (partial flip-edge world-state)]
    (if (re-matches #"edge.*" clicked-what)
      (update-in world-state [:edges clicked-what] constrained-flip)
      world-state)))

(go
  (big-bang!
    :initial-state {:vertices vertices
                    :edges (name-edges bare-edges)}
    :to-draw draw-world
    :on-click update-state))
