From: Robert Feldt Date: 2001-10-23T23:24:42+09:00 Subject: [ruby-talk:23052] [ANN] GraphR 0.1.0 (was Re: WebDot) On Tue, 23 Oct 2001, Tobias Reif wrote: > I'd like to use Ruby+WebDot to generate/serve SVG graphs. > Well it looks like its your lucky day ;-). Really I'm not sure this does what you want but you can generate really simple dot files and get the graphs from them using GraphR (its simply the Graph-related files in rockit extracted to a separate project; very small and unfinished!). See Readme below. Regards, Robert GraphR - Graph-related Ruby classes =================================== Version: 0.1.0 Release date: 2001-10-23 Available from: http://rockit.sf.net/subprojects/graphr Author: Robert Feldt Email: feldt@ce.chalmers.se You can download the tarball from http://rockit.sf.net/subprojects/graphr/graphr-0-1-0.tar.gz. What is it? ----------- Graph-related classes: * DirectedGraph - fairly extensive directed graph class * DotGraphFormatter - output a graph in GraphViz's dot format GraphR is very simple and might grow to support additional features of dot. GraphViz is an open source graph drawing software from AT&T (see http://www.research.att.com/sw/tools/graphviz/). Why? ---- Graphs can be handy (;-)) and dot is a great visualization tool for graphs. Installation? ------------- 1. unpack tarball (if you haven't already) 2. Run tests: ruby -I./lib tests/runtests.rb (OPTIONAL) 3. Install: ruby install.rb You can uninstall with: ruby install.rb --uninstall Example of use? --------------- require 'graph/graphviz_dot' # We specialize a formatter that changes the shape of nodes # based on their names. f = DotGraphFormatter.new( proc{|n| ["start", "stop"].include?(n.to_s) ? "circle" : "box" } ) # In this simple example we don't even have a "real" graph # just Arrays with the nodes and the links. The optional third # element of a link is link information. nodes = [:start, 1, 2, :stop] links = [[:start, 1, "*"], [1, 1, "a"], [1, 2, "~a"], [2, :stop,"*"]] dot_graph = f.format(nodes, links) # And now output to files dot_graph.write_to_file("g.dot") # Generate postscript file dot_graph.write_to_file("g.jpg", "jpeg") # Generate jpeg file Requirements? ------------- Ruby and dot. Dot is only a part of GraphViz. Download at http://www.research.att.com/sw/tools/graphviz/download.html and make sure dot can be run from Ruby by doing system "dot" ie. that dot is installed somewhere in the PATH. NOTE THAT THIS IS AN ALPHA RELEASE SO THERE WILL LIKELY BE BUGS. And the API will probably change in future versions. Documentation? -------------- None yet. For DirectedGraph you can take a look at tests/utest_directed_graph.rb. License and legal issues? ------------------------- GraphR is Copyright (c) 2001 Robert Feldt, feldt@ce.chalmers.se. All rights reserved. and is distributed under GPL. Do you have comments or questions? ---------------------------------- I'd appreciate if you drop me a note if you're successfully using GraphR. If there are some known users I'll be more motivated to packing up additions / new versions and post them to RAA. Happy coding! Robert Feldt, feldt@ce.chalmers.se