CirKit Showcase

This page lists some usage examples of CirKit to demonstrate its possibiilities.

Tweaking show for Mac

The command show defaults to xdg-open as program to open the generated GraphViz files. Mac lacks both this program and a good viewer for GraphViz files. A workaround is to create a PNG file with dot and then open the PNG file instead. There are several ways to do this, but the most convenient is to set the CirKit variable show_dotcmd using set . A good place to set this variable is in the alias file such that it is loaded on start up (if you use the alias file, remember to set the CIRKIT_HOME environment variable to the CirKit directory). We add the following line to the alias file:

set show_dotcmd "dot -Tpng %s > /tmp/test.png; open /tmp/test.png"

Now in a program as the following, a PNG file is created and opened in a Preview window.

cirkit> expr <[a!b]bc>
cirkit> expr > xmg
cirkit> show -x

If you happen to use iTerm2 together with the imgcat extension, you can use it to directly display the PNG file in the terminal. Just use the following as dotcmd

set show_dotcmd "dot -Tpng %s > /tmp/test.png; imgcat /tmp/test.png"