Can Graphviz visualize state transition diagrams like this?

Can Graphviz display state transition diagrams in exactly the same way?

http://upload.wikimedia.org/wikipedia/commons/c/cf/Finite_state_machine_example_with_comments.svg

=== Edit ===

The Marapet code is really close (see: http://i.imgur.com/ElzSl.png ). I accept his answer.

+5
source share
2 answers

I would create nodes for the transition conditions:

digraph g{
  Opened[label="1\nOpened\nE: open door"];
  Closed[label="2\nClosed\nE: closed door"];
  node[shape=plaintext];

  Opened -> close_door[arrowhead=none];
  close_door -> Closed;
  Opened -> open_door[dir=back];
  open_door -> Closed[arrowhead=none];
}
+9
source

I would use a label on the arrow instead of creating a node for close_door:

Open → Closed [label = close_door];

+2
source

All Articles