Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Ruby interface to the GraphViz graphing tool
Ruby XSLT GAP

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
bin
examples
lib
test
.gitignore
AUTHORS
COPYING
ChangeLog.rdoc
README.rdoc
Rakefile
setup.rb

README.rdoc

Ruby/GraphViz

Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Gregoire Lejeune

DESCRIPTION

Interface to the GraphViz graphing tool

SYNOPSIS

A basic example

require 'graphviz'

# Create a new graph
g = GraphViz.new( :G, :type => :digraph )

# Create two nodes
hello = g.add_node( "Hello" )
world = g.add_node( "World" )

# Create an edge between the two nodes
g.add_edge( hello, world )

# Generate output image
g.output( :png => "hello_world.png" )

The same but with a block

require 'graphviz'

GraphViz::new( :G, :type => :digraph ) { |g|
  g.world( :label => "World" ) << g.hello( :label => "Hello" )
}.output( :png => "hello_world.png" )

Create a graph from a file

require 'graphviz'

# In this example, hello.dot is :
#   digraph G {Hello->World;}

GraphViz.parse( "hello.dot", :path => "/usr/local/bin" ) { |g|
  g.get_node("Hello") { |n|
    n[:label] = "Bonjour"
  }
  g.get_node("World") { |n|
    n[:label] = "Le Monde"
  }
}.output(:png => "sample.png")

Ruby/GraphViz also include :

  • ruby2gv, a simple tool that's allow you to create a dependency graph from a ruby script. Example : drp.ly/dShaZ

ruby2gv -Tpng -oruby2gv.png ruby2gv

  • gem2gv, a tools that's allow you to create a dependency graph between gems. Example : drp.ly/dSj9Y

gem2gv -Tpng -oruby-graphviz.png ruby-graphviz

INSTALLATION

sudo gem install ruby-graphviz

You also need to install GraphViz and Treetop

On Windows you also need to install win32-open3. This is not an absolute requirement.

LICENCE

Ruby/GraphViz is freely distributable according to the terms of the GNU General Public License (see the file 'COPYING').

This program is distributed without any warranty. See the file 'COPYING' for details.

Something went wrong with that request. Please try again.