Visualizing a graph using Graphviz

One can easily draw an image that represents a graph using the graphviz library. In the world of data analysis, visually interpreting an image can reveal peculiarities about the data that the human eye can easily pick up. This recipe will let us construct a diagram out of the data we are dealing with. More visualization techniques are explained in Chapter 11, Visualizing Data.

Getting ready

Install the graphviz library from http://www.graphviz.org/Download.php as the Haskell package requires it.

Next, install the package from cabal by running the following command:

$ cabal install graphviz

How to do it...

In a new file, insert the following code. We will name our file Main.hs:

  1. Import the package:
    import Data.GraphViz ...

Get Haskell Data Analysis Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.