In class exercise - Drawing Trees with Graphviz
In this exercise we will draw trees using the Graphviz tool "dot".
To get started do the following
- Download the Graphviz library we discussed in class: Graphviz.hs.
- Go to the Graphviz website and down load the tools.
- Install the tools on your computer. See here.
You might have to add "dot.exe" to your PATH variable (see here.)
- Cut and paste the program template below to get started.
- Define your own tree like data type, called Tree, by adding a "data" declaration.
- Add Instance declarations for Tree, LabeledTree, and Functor
- Define several values, tree1, tree2, and tree3, of type Tree.
- Use the function toPng (from the Graphviz module) to draw pictures of your tree.
module UsingDot where
data MyTree a = ...
tree1:: MyTree ?
tree1 = ...
tree2:: MyTree ?
tree2 = ...
tree3:: MyTree ?
tree3 = ...
main = toPng tree1
Back to the Daily Record.
Back to the class web-page.