meruby / gmail.com wrote:
> I have basic program using rgl library which creates dot file and
> display it using dotty.
>
> *************************************************
> require 'rgl/adjacency'
> require 'rgl/dot'
> dg = RGL::DirectedAdjacencyGraph[1,2 ,2,3 ,2,4, 4,5, 6,4, 1,6]
> dg.dotty
> *************************************************
>
> I have modified this program to change default property as follows:
>
> *************************************************
> require 'rgl/adjacency'
> require 'rgl/dot'
> dg = RGL::DirectedAdjacencyGraph[1,2 ,2,3 ,2,4, 4,5, 6,4,
> 1,6].to_dot_graph("fontsize"=>30)
> *************************************************
>
>
> I have following questions:
> 1. How can I save/view this as dot file?
Look at #write_to_graphic_file(fmt='png', dotfile="graph")
> 2. How can I apply property to vertices and edges
> 3. Is there any way I can add my own property key/value to vertices
and
> edges
As every object can be a vertex, you can use instance variables as
properties. Be careful to implement hash and eql? if using
RGL::DirectedAdjacencyGraph, because it uses hashes and sets for
implementing for adjacency lists.
>
> Any small program will be wonderful help to ruby community who wants
to
> use this wonderful library.

If I have more time I will give more examples at the the rgl wiki
(http://rgl.rubyforge.org/wiki/wiki.pl). Meanwhile take a look in the
example directory of the distribution.

Cheers
Horst