Is anyone using RGL and to draw graphs? I was able to install and get basic
graphs going in a few minutes, but can’t see how to customize the appearance of
vertices.
Is there a way of defining attributes of nodes in an
RGL::DirectedAdjacencyGraph so that
RGL uses a variation of dot.rb coming with RDoc (http://rdoc.sf.net). The file
is called rdot.rb in the RGL-Distribution to avoid confusion when both
libraries are installed. In rdot.rb defines classes DOTNode and DOTEdge which
allow nearly all features of Graphviz (error)
to customize appearance.
RGL’s Graph#to_dot_graph (in rgl/dot.rb) allows to change the attributes of the
appearance of the whole graph (all attributes listed in DOT::GRAPH_OPTS are
allowed):
will use fontsize 30 for all vertices instead of the default of 8.
To change the appearance of single vertices (or edges) you have to improve the
method to_dot_graph which uses default attributes for vertices and nodes. Since
vertices of RGL Graphs can be any ruby object you could store the graphical
attributes in the vertex object and convert them in your own Graph#to_dot_graph
to appropriate graphviz attributes.
An alternative could be to have a method Object#to_dot_node which would return
a DOT::DOTNode.