                                   ))
                          ))
 
+(defn redraw-graph []
+  (let [current (:graph @state)]                            ; Must be set by importer on creation
+    (if current
+      (do
+        (.kill current)
+        (swap! state assoc :graph nil)))
+    (create-graph (-> (.getElementById js/document "trope-code") .-value))
+    ))
+
 
 (defn plot []
   [:div
+   (text-input :trope-code "Trope code:")
    [:input {:type     "button" :value "Graph!"
-            :on-click #(create-graph)}]
+            :on-click #(redraw-graph)}]
    [:div {:id "container"}]])
 
 (def pages
   {:home  plot
    :about about-page})
-
-
 
 
 (defn page []

                                              :edgeLabelSize    "proportional"
                                              }})
                         (fn [s]
                           (goog.object/forEach (-> s .-graph .nodes)
                                                #(aset % "originalColor" "#ff0000"))
                           (goog.object/forEach (-> s .-graph .edges)

(defn in-seq? [s x]
  (some? (some #{x} s)))

(defn create-graph [code]
  (js/sigma.parsers.json (str js/context "/api/network/" code)
                         (clj->js {
                                   :renderer {:container (.getElementById js/document "container")
                                              :type      "canvas"
