 (ns jungerer.vis
+  "Functions to visualize a graph on Swing."
   (:import java.awt.Dimension
            javax.swing.JFrame
            [edu.uci.ics.jung.algorithms.layout CircleLayout FRLayout ISOMLayout

;; ------

(defn ^CircleLayout circle-layout
  [graph]
  (CircleLayout. graph))

(defn ^FRLayout fr-layout
  [graph]
  (FRLayout. graph))

(defn ^ISOMLayout isom-layout
  [graph]
  (ISOMLayout. graph))

(defn ^KKLayout kk-layout
  [graph]
  (KKLayout. graph))

(defn ^SpringLayout spring-layout
  [graph]
  (SpringLayout. graph))


;; -------------

(defprotocol Visualizable
  (view [this] [this option]
    "Visualizes graph on Swing. The first argument must be
  edu.uci.ics.jung.graph.Graph or edu.uci.ics.jung.algorithms.layout.Layout. The
  optional second argument is an option map including :title, :frame-size, and
  :layout-size."))

(extend-type Graph
  Visualizable
