Created
September 19, 2014 02:17
-
-
Save wavejumper/f4e55e03ce6ec54e4235 to your computer and use it in GitHub Desktop.
Visualize hierarchy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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