Titanium-Loom defines an interface between Titanium, a Clojure graph library by Clojurewerkz, and Loom, a Clojure graph algorithms and visualization library.
loom.titanium - integration API
For information on how to create a Titanium graph, see tutorial.
(def default-graph (titanium->loom titanium-graph))
(def custom-graph (titanium->loom titanium-graph
:node-fn (clojurewerkz.titanium.vertices/find-by-kv :age 22)
:edge-fn (->> (clojurewerkz.titanium.edges/get-all-edges)
(filter #(not= % 1)))
:weight-fn (constantly 22))
custom-graph is created with custom node, edge, and weight functions. This allows the user to convert to Loom representation a subset of the graph stored in the database, if the graph is too big and would not fit into memory, or if only parts of the data are of interest for the analysis.
default-graph is created using node, edge, and weight functions with default behavior. The node and edge functions return all of the vertices and edges (respectively) in the Titanium graph. The default weight function returns 1 for any given edge.
If you have GraphViz installed, and its binaries are in the path, you can view graphs with
(view default-graph) ;opens image in default image viewer
See Loom's documentation on how to inspect the Loom graph and run graph algorithms on it.
- Optional for visualization: GrapViz.
- Add support for infinite graphs
- Use more efficient data structures
- Maybe add validations
Copyright (C) 2013 Aysylu Greenberg.
Distributed under the Eclipse Public License, the same as Clojure.