Clojure network/graph library wrapping JUNG.
Jungerer is available as a Maven artifact from Clojars.
With Leiningen/Boot:
[jungerer "0.4.1"]
- jungerer.graph - creates and manipulates graph
- jungerer.algo - calculates scores such as PageRank
- jungerer.vis - visualizes graph on Swing
- jungerer.io - load/saves external graph formats
See example project to quickly try Jungerer.
jungerer.graph:
(require '[jungerer.graph :as g])
(def graph (g/directed-graph [[1 2] [2 3] [4 2]]))
(g/add-edge! graph [4 5])
(g/nodes graph)
;;=> #{1 4 3 2 5}
(g/edges graph)
;;=> ([1 2] [2 3] [4 5] [4 2])
jungerer.algo:
(require '[jungerer.algo :as a])
(def scorer (a/page-rank graph))
(a/score scorer 2)
;;=> 0.26350079629361517
(a/dijkstra-path graph 4 3)
;;=> [4 2 3]
jungerer.vis:
(require '[jungerer.vis :as v])
;; To visualize simply,
(v/view graph)
;; To specify layout and other options,
(v/view (v/kk-layout graph) {:title "My Graph"
:frame-size [640 480]
:node-label-fn (fn [node]
(str "node" node))
:edge-label-fn (fn [[node1 node2]]
(str node1 " -> " node2))})
jungerer.io:
(require '[jungerer.io :as i])
(def graph (g/directed-graph))
(i/load-pairs! "dev-resources/sample.pairs" graph)
(g/add-edge! graph ["AAA" "LLL"])
(i/save-as-pairs "/tmp/sample-edited.pairs" graph)
Copyright © 2016-2019 Toshiki Takeuchi
Distributed under the BSD 3-Clause License.