jakesgordon/javascript-state-machine — pull request #51 by hansmi (2013-06-17 01:03:52+00:00)
Title: Request for comments: Generating Graphviz/Dot graph from state machine

As requested in issue #31 this patch adds an instance method to generate a Graphviz/Dot graph describing the state machine. While it works for my purposes I'd like to ask for comments first before I write documentation and tests.

To have a stable output the nodes and edges are sorted. The initial event is moved to the front as to get slightly nicer graphs.

Graph for the included demo (generated using `fsm.getDotGraph("start")` and then passed to `dot -Nfontname=Courier -Efontname=Courier -Gresolution=150 -Tpng`):

![demograph](https://f.cloud.github.com/assets/3238454/660153/2aeb17a6-d6e9-11e2-834c-7cc89691f3df.png)