zappala/bene — pull request #1 by kcorbitt (2014-03-21 05:34:21+00:00)
Title: added network graphing functionality

Dr. Zappala,

I've added a module to bene that allows for the automatic generation of network graphs/diagrams.

This extension is built on the open-source [Graphviz](http://www.graphviz.org/) project (available in most package managers) with the [pydot](https://code.google.com/p/pydot/) bindings. Note that including this does not increase bene's dependencies because pydot won't be imported unless someone chooses to use the graph functionality.

Three types of graphs are available.

**Network graphs** analyze the links and nodes in a network:
```python
# Graph a simple network
g1 = graph.Graph(node.allNodes)
g1.write_png('graphs/network.png')
```
![network](https://f.cloud.github.com/assets/176426/2480363/599ae248-b0b9-11e3-8dea-5e46edba0c2a.png)

**Path graphs** highlight the path from one selected node to another:
```python
# Graph the route from n2 to n5 in the network
g2 = graph.Graph(node.allNodes)
g2.overlay_path('n2', 'n5', color='red')
g2.write_png('graphs/path.png')
```
![path](https://f.cloud.github.com/assets/176426/2480379/d42e43ce-b0b9-11e3-8b7c-a07051eb794d.png)

**All-path graphs** display all paths in the network to a given node:
```python
# Graph all paths to n1 in the network
g3 = graph.Graph(node.allNodes)
g3.overlay_all_paths('n1', color='blue')
g3.write_png('graphs/all_paths.png')
```
![all_paths](https://f.cloud.github.com/assets/176426/2480385/fae82034-b0b9-11e3-9974-672dd489c783.png)

See the diff for more details.