Using GraphViz
- Download and install the GraphViz software
onto your computer. After accepting the end-user license, choose the
appropriate package for your platform. Download the binary (executable)
package unless you want
to have an adventure building it from source.
- Look over the Gallery
and Documentation
areas of the GraphViz website. Find the Finite Automaton example
from the Gallery and study the graphical representation of the automaton
and how it was coded up.
- Copy the automaton coding commands (remember to get the final closing bracket!)
into a new text file and save it somewhere, e.g. on your desktop. VERY
IMPORTANT: make sure you save it as a text file, not a word processor file
(e.g. a .docx file or a .wpd file or a .rtf file). For example, I put the
file on my desktop and called it fsm.txt. (Note to Mac users: if you
experience any problems, use for a filename extension for the input file .gv instead of .txt).
- Now generate the picture of the automaton. Either:
- Follow the Edit in Playground link and use that online generator.
- Use the command shell to pipe
(i.e. type on Windows or cat on Linux) the automaton code file through the
dot command (with appropriate paths) and saving the output:
> cat C:\Users\me\Desktop\fsm.txt |
"C:\Program files\Graphviz\bin\dot.exe" -Tjpg > C:\Users\me\Desktop\fsm.jpg
- Finally, use the playground or a text editor to design your own automaton of any type and of non-trivial size, code it up in
another file, and generate a picture of it.
Note: You may find this GraphViz pocket reference
helpful as a beginner's tutorial.
Send me an email with your inputs and outputs from steps 4 and 5, and mention
what experience you have had diagramming FSA's before and speculate on how you
think they may useful for you in the future.