Skip to content

Instantly share code, notes, and snippets.

@wavejumper
Created September 19, 2014 02:17
Show Gist options
  • Save wavejumper/f4e55e03ce6ec54e4235 to your computer and use it in GitHub Desktop.
Save wavejumper/f4e55e03ce6ec54e4235 to your computer and use it in GitHub Desktop.
Visualize hierarchy
(use 'rhizome.viz)
(defn hierarchy [root]
(for [d (descendants root)
:when (some #{root} (parents d))
:let [h (hierarchy d)]]
(if (empty? h) d [d h])))
(defn hierarchy-graph [root]
(view-tree sequential? seq [root (hierarchy root)]
:node->descriptor (fn [n] {:label (when (keyword? n) n)})))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment