Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

7. Going Beyond Basic Lists > Creating a Graph

Creating a Graph

Graphviz generates graphs from your data. Indeed, you saw a simple Graphviz representation of the wizard’s house in Chapter 5:

image with no caption

Graphviz is open source and available from the Graphviz website (http://www.graphviz.org/). After you’ve downloaded and installed it, creating a graph is easy. First, you’ll create a DOT file that describes the shape of your graph. For example, in Graphviz, create a file named test.dot on your computer and enter the following information:

digraph {
   a->b;
}

This defines a directed graph with nodes A and B connected by an arrow. (There are numerous syntax options available in the DOT file format, as documented at the Graphviz website.)

Now, to generate a graphical bitmap from the DOT file, run neato (one of the Graphviz utilities) from the command line, as follows:


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint