Titanium-Loom defines an interface between Titanium, a Clojure graph library by Clojurewerkz, and Loom, a Clojure graph algorithms and visualization library.
[aysylu/titanium-loom "0.1.4"]
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))
The 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.
The 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 loom.io/view
:
(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.
- Clojure
- Loom
- Titanium
- Optional for visualization: GrapViz.
- Add support for infinite graphs
- Use more efficient data structures
- Maybe add validations
- [Aysylu Greenberg] (https://github.com/aysylu), aysylu [dot] greenberg [at] gmail [dot] com, @aysylu22
Copyright (C) 2013 Aysylu Greenberg.
Distributed under the Eclipse Public License, the same as Clojure.