                   (crate/html [:div#forsvg
                                 (make-svg [1000 1000] world-state)])))
 
-(defn inflow [edges vertex]
-  (let [in-going (for [[_ [_ to color]] edges
-                       :when (= to vertex)]
-                   (color->value color))]
-    (apply + in-going)))
 
-(defn ok-to-flip? [{:keys [vertices edges]} [_ to color]]
-  (let [edge-value (color->value color)
-        to-inflow (inflow edges to)
-        to-vertex-value (first (vertices to))]
-    (>= (- to-inflow edge-value) to-vertex-value)))
 
 (defn flip-edge [world-state [from to color :as edge]]
   (if (ok-to-flip? world-state edge)

    (string/join " " (map str ["M" "L" "L"] coords))))


(defn svg-edge [[id [from to color]]]
  [:svg:path
   {:class "clickable"
    :id id

       {:x x :y (+ 5 y)
        :fill "black"
        :text-anchor "middle"}
       (str free) ]))
  )

(defn event->targetid [e]
