Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>(This addresses your original question, described in the title, and doesn't go into the problems installing chart-cairo or chart, etc, which really should be spun out into different questions)....</p> <p>The graphviz package includes some example graphs in module Data.Graph.Inductive.Example that can be used to get you up and running. You can see the list of included graphs at <a href="http://hackage.haskell.org/package/fgl-5.3/docs/Data-Graph-Inductive-Example.html" rel="nofollow noreferrer">http://hackage.haskell.org/package/fgl-5.3/docs/Data-Graph-Inductive-Example.html</a>.... I will use one called <code>clr479</code>.</p> <p>Once you have a graph, you can convert it to an internal structure representing the dot format using <code>graphToDot</code>. Note that you will need to supply some parameters, which are described in <a href="http://hackage.haskell.org/package/graphviz-2999.11.0.0/docs/Data-GraphViz.html" rel="nofollow noreferrer">http://hackage.haskell.org/package/graphviz-2999.11.0.0/docs/Data-GraphViz.html</a>. Just to get up and running, I will use the supplied <code>nonClusteredParams</code>.</p> <pre><code>let graphInDotFormat = graphToDot nonClusteredParams clr479 </code></pre> <p>Then, you will need to convert this to text suitable for input to the <code>dot</code> program. You can do this with <code>renderDot . toDot</code></p> <pre><code>let outputText = renderDot $ toDot graphInDotFormat </code></pre> <p>and, as usual, you need to convert text to string to use <code>putStrLn</code> (don't just use <code>show</code>, as it will include quotes and escape sequences, which <code>dot</code> will not understand)</p> <pre><code>putStrLn $ unpack outputText </code></pre> <p>Putting this all together, the final program createDotFile.hs would be</p> <pre><code>import Data.Text.Lazy import Data.GraphViz import Data.Graph.Inductive.Example import Data.GraphViz.Printing main = putStrLn $ unpack $ renderDot $ toDot $ graphToDot nonClusteredParams clr479 </code></pre> <p>Compile using <code>ghc createDotFile.hs</code> (remember to cabal install the required packages, as well as graphviz itself if you want to do anything with the output). On the commandline, you can now pipe the output of this program to <code>dot</code>, which will convert this to a usual format.... For instance, here I convert to svg</p> <pre><code>./createDotFile | dot -Tsvg &gt; graph.svg </code></pre> <p>which on my linux box can be viewed by typing</p> <pre><code>eog graph.svg </code></pre> <p><img src="https://i.stack.imgur.com/QQgMd.jpg" alt="visualization of clr479"></p> <hr> <p>Edit-</p> <p>To clarify, the output of the haskell program needs to be provided as an input to GraphViz. The msi file to install graphviz on windows here <a href="http://www.graphviz.org/Download_windows.php" rel="nofollow noreferrer">http://www.graphviz.org/Download_windows.php</a>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload