Book Image

Haskell Data Analysis Cookbook

By : Nishant Shukla
Book Image

Haskell Data Analysis Cookbook

By: Nishant Shukla

Overview of this book

Table of Contents (19 chapters)
Haskell Data Analysis Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Customizing the looks of a graph network diagram


To better present the data, we will cover how to customize the design of a graphical network diagram.

Getting ready

To use Graphviz, the graph visualization library, we must first install it on the machine. The official website of Graphviz contains the download and installation instructions available at http://www.graphviz.org. On Debian-based operating systems, Graphviz can be installed using apt-get as follows:

$ sudo apt-get install graphviz-dev graphviz

Next, we need to install the Graphviz Haskell bindings from Cabal as follows:

$ cabal install graphviz

How to do it…

  1. Import the relevant functions and libraries to customize a Graphviz graph as follows:

    import Data.Text.Lazy (Text, pack, unpack)
    import Data.Graph.Inductive (Gr, mkGraph)
    import Data.GraphViz (
      GraphvizParams(..),
      GlobalAttributes(
        GraphAttrs,
        NodeAttrs,
        EdgeAttrs
        ),
      X11Color(Blue, Orange, White),
      nonClusteredParams,
      globalAttributes,
      fmtNode,
      fmtEdge...