README in rgl-0.2.2 vs README in rgl-0.2.3

- old
+ new

@@ -37,17 +37,17 @@ * Extension through Function Objects and Visitors * Element Type Parameterization * Vertex and Edge Property Multi-Parameterization The first is easily achieved in RGL using mixins, which of course is not as -efficient than C++ templates (but much more readable :-). The second one is even -more easily implemented using standard iterators with blocks or using the -Stream module. The third one is no issue since Ruby is dynamically typed: Each -object can be a graph vertex. There is no need for a vertex (or even edge -type). In the current version of RGL properties of vertices are simply attached -using hashes. At first there seems to be not much need for the graph property -machinery. +efficient than C++ templates (but much more readable :-). The second one is +even more easily implemented using standard iterators with blocks or using the +Stream[http://rgl.rubyforge.org/stream/files/README.html] module. The third one +is no issue since Ruby is dynamically typed: Each object can be a graph +vertex. There is no need for a vertex (or even edge type). In the current +version of RGL properties of vertices are simply attached using hashes. At +first there seems to be not much need for the graph property machinery. === Algorithms The first version of RGL only contains a core set of algorithm patterns: @@ -85,26 +85,53 @@ module Graph. The complexity guarantees can not necessarily provided. See http://www.boost.org/libs/graph/doc/graph_concepts.html == Installation -RGL is depended on the _stream_ library which can also be downloaded from -http://rubyforge.org/frs/?group_id=110. +RGL is depended on the +stream[http://rgl.rubyforge.org/stream/files/README.html] library which can +also be downloaded from http://rubyforge.org/frs/?group_id=110. If you use gem +to install RGL the stream library will be installed as a prerequisite. === GEM Installation Download the GEM file and install it with .. - gem install rgl-VERSION.gem + % gem install rgl-VERSION.gem or directly with - gem install rgl + % gem install rgl Use the correct version number for VERSION (e.g. 0.2.2). You may need root privileges to install. +=== Running tests + +RGL comes with a Rakefile which automatically runs the tests. Goto the +installation directory and start rake: + + % gem env + Rubygems Environment: + - VERSION: 0.8.3 (0.8.3) + - INSTALLATION DIRECTORY: /usr/lib/ruby/gems/1.8 + - GEM PATH: + - /usr/lib/ruby/gems/1.8 + - REMOTE SOURCES: + - http://gems.rubyforge.org + + % cd /usr/lib/ruby/gems/1.8/gems/rgl-0.2.2/ + % r40> rake + (in /usr/lib/ruby/gems/1.8/gems/rgl-0.2.2) + ruby1.8 -Ilib:tests -e0 -rtests/TestGraphXML -rtests/TestComponents -rtests/TestDirectedGraph -rtests/TestEdge -rtests/TestImplicit -rtests/TestTransitiveClosure -rtests/TestTraversal -rtests/TestUnDirectedGraph + Loaded suite -e + Started + ........................................................................................................ + Finished in 0.736444 seconds. + + 40 tests, 421 assertions, 0 failures, 0 errors + === Normal Installation You have to install stream library before. You can than install RGL with the following command: @@ -128,12 +155,12 @@ irb> dg.vertices [5, 6, 1, 2, 3, 4] irb> dg.has_vertex? 4 true -Every object could be a vertex (there is no class Vertex), even the class object -_Object_: +Every object could be a vertex (there is no class Vertex), even the class +object _Object_: irb> dg.has_vertex? Object false irb> dg.edges.sort.to_s "(1-2)(1-6)(2-3)(2-4)(4-5)(6-4)" @@ -156,11 +183,11 @@ irb> dg.remove_edge 4,2 true <em>Topological sort</em> is realized with as iterator: - require 'graph/traversal' + require 'graph/topsort' irb> dg.topsort_iterator.to_a [1, 2, 3, 6, 4, 5] A more elaborated example showing <em>implicit graphs</em>: @@ -176,20 +203,20 @@ } g.directed = true } end -This function creates a directed graph with vertices being all loaded modules: +This function creates a directed graph, with vertices being all loaded modules: g = module_graph We only want to see the ancestors of RGL::AdjacencyGraph: tree = bfs_search_tree_from(g,RGL::AdjacencyGraph) -Now we want to visualize this component of g with DOT. We therefore create a -subgraph of the original graph using a filtered graph: +Now we want to visualize this component of g with DOT. We therefore create a +subgraph of the original graph, using a filtered graph: g = g.vertices_filtered_by {|v| tree.has_vertex? v} Create the graphics with DOT: @@ -206,29 +233,26 @@ (http://rockit.sf.net/subprojects/graphr) who pointed me to BGL and many other graph resources. Manuel Simoni found a subtle bug in a preliminary version announced at http://rubygarden.com/ruby?RubyAlgorithmPackage/Graph. Robert kindly allowed to integrate his work on graphr, which I did not yet -succeed. Especially his work to output graphs for GraphViz (see -http://www.research.att.com/sw/tools/graphviz/download.html) is much more -elaborated than the minimal support in dot.rb. +succeed. Especially his work to output graphs for +GraphViz[http://www.research.att.com/sw/tools/graphviz/download.html] is much +more elaborated than the minimal support in dot.rb. -Jason Voegele for set.rb implementing sets using hashes. These are used in the -implementation of adjacency lists in AdjacencyGraph. - Jeremy Siek one of the authors of the nice book "The Boost Graph Library (BGL)" -(http://cseng.awl.com/book/0,3828,0201729148,00.html) kindly allowed to use the +(http://www.boost.org/libs/graph/doc) kindly allowed to use the BGL documentation as a _cheap_ reference for RGL. He and Robert also gave feedback and many ideas for RGL. -Dave Thomas for RDoc (http://rdoc.sourceforge.net) which generated what you read +Dave Thomas for RDoc[http://rdoc.sourceforge.net] which generated what you read and matz for Ruby. Dave included in the latest version of RDoc (alpha9) the -module dot/dot.rb which I use instead of Roberts module to visualize graphs (see -rgl/dot.rb). +module dot/dot.rb which I use instead of Roberts module to visualize graphs +(see rgl/dot.rb). == Copying -RGL is Copyright (c) 2002,2004 by Horst Duchene. It is free software, and may be +RGL is Copyright (c) 2002,2004,2005 by Horst Duchene. It is free software, and may be redistributed under the terms specified in the README file of the Ruby distribution. == Support