From b07da72373fd1467be9bf030e2849800894bc1ab Mon Sep 17 00:00:00 2001 From: zerosalife Date: Sat, 26 Apr 2014 09:41:26 -0500 Subject: [PATCH] Add example of graph with labeled edges Added some code that generates the example graph `g` with labels for the edges. I reckon you will have to generate the .png because they're hosted on dropbox. Thanks for Rhizome! --- README.markdown | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.markdown b/README.markdown index 01100f5..e0bb89e 100644 --- a/README.markdown +++ b/README.markdown @@ -57,6 +57,20 @@ nil ![](https://dl.dropboxusercontent.com/u/174179/rhizome/example_graph.png) +And an example with labeled edges: + +```clj +> (def g-edges + {:a {:b :makes + :c :takes} + :b {:c :takes} + :c {:a :makes}}) +#'g-edges +> (view-graph (keys g) g + :node->descriptor (fn [n] {:label n}) + :edge->descriptor (fn [src dst] {:label (dst (src g-edges))})) +``` + Clusters are a way of grouping certain nodes together. They can be any object you like, including values also used by a node. Using `:cluster->parent`, they can be nested: ```clj