Modelling state machines
Monday, April 14, 2008 7:11:05 PM
The following example (from Wikipedia) shows a simplified example of what I'd like to get as the end result.
It seemed like Graphviz was a sure fit to those criteria. This is what the above graph would look like if written in the DOT language that graphviz groks:
digraph simple_state_machine {
node [shape = doublecircle]; S1;
node [shape = circle] S2;
node [shape = point] S0;
S0 -> S1;
S1 -> S2 [ label = "0" ];
S1 -> S1 [ label = "1" ];
S2 -> S1 [ label = "0" ];
S2 -> S2 [ label = "1" ];
} As you see this is fairly easy to write, and super easy to change. Exactly what I wanted in other words. Here's the output file:Now the end result isn't as nice as the first example, which was "hand-drawn" in Inkscape judging by the comments in the file. Which brings me to my question: is there a program that can process the DOT input to produce something more similar to the first picture?









Unregistered user # Tuesday, April 15, 2008 8:30:02 AM
Dan Alexandrudantesoft # Tuesday, April 15, 2008 7:20:18 PM
Erik DahlströmMacDev_ed # Wednesday, April 16, 2008 10:04:17 AM
Unregistered user # Wednesday, April 16, 2008 2:02:49 PM
Erik DahlströmMacDev_ed # Wednesday, April 30, 2008 10:24:45 AM
There are a number of things I'd like to do with the svg output:
1. use a <style> element to get less duplication (makes files smaller)
2. arrows should use svg markers, instead of being just a dumb path duplicated everywhere
3. get rid of the DTD cruft
4. make sure "px" is specified on font-size in style attributes (if used at all)