Foma: Drawing graphical automata with DOT

Foma can be used on Hippu servers. Foma has a documented facility print dot which produces a DOT graph which represents the finite-state network on the top of the Foma stack. The command can also write the DOT graph as a file on the disk. Such a DOT file can be converted into common graphical formats (such as PNG, SVG, etc.) using the dot program which belongs to the Graphviz package and is available on the Hippu servers. In this way, one can produce graphics files which can be attached to web pages or included in documents.

If one wishes to display the graphic image as such on your terminal, you must

  1. Enable graphic connections using one of the following methods:
    • On Mac: Start X11 and use -X switch in your SSH connection
    • On Mac: muuta SSH:n asetuksia pysyvästi komennolla sudo emacs -nw /etc/ssh_config niin, että konfiguraatiotiedostossa on kommentoimatta rivi jossa lukee ForwardX11 yes.
    • On Win: Start the WinAxe program, see http://www.ling.helsinki.fi/atk/perusohj/yhteys/ for more instructions on the graphical connection.
    • On Win & Putty: Open / Install Xming server: http://sourceforge.net/projects/xming/: run the Xming Setup, then specify the folder Z:\Desktop\Xming (in UH workstations), select full installation, accept the shortcut folder "Xming", click "Create a desktop icon for Xming", and complet installation. Choose "Start no client". Open putty and set from configuration SSH -> X11 -> Enable X11 forwarding. Then everything should be ok. (If you need more Xming windows etc. this can be configured with XLaunch.exe, to be found in Xming folder.
    • On Mac/Win: Start the NoMachine program, see ...
  2. Create an automaton (i.e. network) with Foma. Write the DOT file on disk within Foma by print dot > xxx.dot or just dot > xxx.dot
  3. Interrupt the Foma by Ctrl-z
  4. Then either:
    • Display the DOT file directlt with the command dotty xxx.dot. The drawing is not nice, however, and you might want to use the following method
    • Convert the DOT file into a PNG file by the following command on the command line: dot -Tpng xxx.dot > xxx.png and
      start a program on Hippu for displaying graphic images by typing gthumb xxx.png& and open the xxx.png file with it.
  5. Return to Foma by typing fg on the command line.

Foma has the view command for directly drawing the picture. On this command, Foma runs command /usr/bin/open -a Graphviz $1.dot &. It would be possible to modify Foma source in such a way that it runs dot -Tpng $1.dot >$1.png at this point.

-- KimmoKoskenniemi - 2012-03-13
-- AnssiYliJyra - 2013-01-16

Topic revision: r5 - 2013-01-17 - AnssiYliJyra
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback