rgl 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. data/ChangeLog +19 -10
  2. data/Gemfile +3 -0
  3. data/{README → README.rdoc} +70 -98
  4. data/Rakefile +44 -150
  5. data/examples/canvas.rb +63 -64
  6. data/examples/examples.rb +42 -42
  7. data/examples/graph.dot +46 -0
  8. data/examples/images/example.jpg +0 -0
  9. data/examples/images/module_graph.jpg +0 -0
  10. data/examples/images/rgl_modules.png +0 -0
  11. data/examples/{insel-der-tausend-gefahren.rb → insel_der_tausend_gefahren.rb} +18 -19
  12. data/examples/north.rb +2 -2
  13. data/examples/north2.rb +11 -11
  14. data/examples/rdep-rgl.rb +218 -222
  15. data/lib/rgl/adjacency.rb +78 -74
  16. data/lib/rgl/base.rb +160 -78
  17. data/lib/rgl/bellman_ford.rb +115 -0
  18. data/lib/rgl/bidirectional.rb +17 -10
  19. data/lib/rgl/bipartite.rb +87 -0
  20. data/lib/rgl/condensation.rb +13 -4
  21. data/lib/rgl/connected_components.rb +38 -30
  22. data/lib/rgl/dijkstra.rb +158 -0
  23. data/lib/rgl/dijkstra_visitor.rb +42 -0
  24. data/lib/rgl/dot.rb +40 -32
  25. data/lib/rgl/edge_properties_map.rb +55 -0
  26. data/lib/rgl/edmonds_karp.rb +136 -0
  27. data/lib/rgl/enumerable_ext.rb +4 -1
  28. data/lib/rgl/graph_iterator.rb +15 -0
  29. data/lib/rgl/graph_visitor.rb +138 -0
  30. data/lib/rgl/graph_wrapper.rb +15 -0
  31. data/lib/rgl/graphxml.rb +20 -10
  32. data/lib/rgl/implicit.rb +68 -66
  33. data/lib/rgl/mutable.rb +37 -31
  34. data/lib/rgl/path_builder.rb +40 -0
  35. data/lib/rgl/prim.rb +52 -0
  36. data/lib/rgl/rdot.rb +411 -374
  37. data/lib/rgl/topsort.rb +23 -16
  38. data/lib/rgl/transitivity.rb +29 -27
  39. data/lib/rgl/traversal.rb +67 -205
  40. data/rakelib/dep_graph.rake +4 -3
  41. data/test/bellman_ford_test.rb +187 -0
  42. data/test/bipartite_test.rb +47 -0
  43. data/test/components_test.rb +80 -0
  44. data/test/cycles_test.rb +60 -0
  45. data/test/dijkstra_test.rb +148 -0
  46. data/test/directed_graph_test.rb +118 -0
  47. data/test/dot_test.rb +26 -0
  48. data/test/edge_properties_map_test.rb +63 -0
  49. data/test/edge_test.rb +35 -0
  50. data/test/edmonds_karp_test.rb +105 -0
  51. data/{tests/TestGraph.rb → test/graph_test.rb} +6 -6
  52. data/test/graph_xml_test.rb +57 -0
  53. data/test/implicit_test.rb +53 -0
  54. data/test/prim_test.rb +98 -0
  55. data/{tests/TestRdot.rb → test/rdot_test.rb} +309 -308
  56. data/{tests → test}/test_helper.rb +4 -1
  57. data/{tests/TestTransitivity.rb → test/transitivity_test.rb} +43 -43
  58. data/test/traversal_test.rb +221 -0
  59. data/test/undirected_graph_test.rb +103 -0
  60. metadata +226 -145
  61. data/examples/example.jpg +0 -0
  62. data/examples/module_graph.jpg +0 -0
  63. data/install.rb +0 -49
  64. data/tests/TestComponents.rb +0 -65
  65. data/tests/TestCycles.rb +0 -61
  66. data/tests/TestDirectedGraph.rb +0 -125
  67. data/tests/TestDot.rb +0 -18
  68. data/tests/TestEdge.rb +0 -34
  69. data/tests/TestGraphXML.rb +0 -57
  70. data/tests/TestImplicit.rb +0 -52
  71. data/tests/TestTraversal.rb +0 -220
  72. data/tests/TestUnDirectedGraph.rb +0 -102
data/ChangeLog CHANGED
@@ -1,15 +1,25 @@
1
- 2008-08-28 01:36 javanthropus
2
-
3
- * ChangeLog (tags: REL_0_4_0): pre-tag commit
4
-
5
- 2008-08-28 01:36 javanthropus
6
-
7
- * Rakefile (tags: REL_0_4_0): Update rdoc2rf task to use rsync and
8
- more generic remote path specification
1
+ 2014-12 Release 0.5.0
2
+
3
+ This release mainly contains the contributions of Kirill, who added many algorithms to the library. Thank you Kirill!
4
+
5
+ * @matiaskorhonen: Fixes the image paths in the README (#14)
6
+ * @monora: Implicit graph example fails (#13)
7
+ * @KL-7: Implement Graph#bipartite_sets. (#12)
8
+ * @monora: syntax error in dot file for undirected graph (#11)
9
+ * @KL-7: Edmonds-Karp algorithm for maximum flow (#10)
10
+ * @KL-7: Prim's algorithm for minimum spanning tree (#9)
11
+ * @carlosantoniodasilva: Run tests on Ruby 2.0 and remove deprecation warning (#8)
12
+ * @KL-7: Bellman-Ford shortest paths algorithm (#7)
13
+ * @KL-7: Minor improvements (asserts) for Dijkstra algorithm (#6)
14
+ * @KL-7: Add Dijkstra shortest path algorithm. (#5)
15
+ * @KL-7: Indentation and whitespaces clean up of examples (#4)
16
+ * @KL-7: Travis configuration and README updates (#3)
17
+ * @KL-7: Code clean up and configuration updates (#2)
18
+ * @aschoerk: Renamed test-directory, (includes Rakefile), fixed TestComponents (#1)
9
19
 
10
20
  2008-08-27 23:30 javanthropus
11
21
 
12
- * lib/rgl/base.rb (tags: REL_0_4_0): Preparing for 0.4.0 release
22
+ * lib/rgl/base.rb: Preparing for 0.4.0 release
13
23
 
14
24
  2008-08-26 20:07 javanthropus
15
25
 
@@ -476,4 +486,3 @@
476
486
  2002-08-19 21:58 monora
477
487
 
478
488
  * README (tags: V0_2): Added link to SF.
479
-
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
@@ -1,4 +1,4 @@
1
- = Ruby Graph Library (RGL)
1
+ = Ruby Graph Library (RGL) {<img src="https://secure.travis-ci.org/monora/rgl.png?branch=master" alt="Build Status" />}[https://travis-ci.org/monora/rgl]
2
2
 
3
3
  RGL is a framework for graph data structures and algorithms.
4
4
 
@@ -39,39 +39,41 @@ genericity:
39
39
  * Vertex and Edge Property Multi-Parameterization
40
40
 
41
41
  The first is easily achieved in RGL using mixins, which of course is not as
42
- efficient than C++ templates (but much more readable :-). The second one is
43
- even more easily implemented using standard iterators with blocks or using the
44
- Stream[http://rgl.rubyforge.org/stream/files/README.html] module. The third one
45
- is no issue since Ruby is dynamically typed: Each object can be a graph
46
- vertex. There is no need for a vertex (or even edge type). In the current
47
- version of RGL properties of vertices are simply attached using hashes. At
48
- first there seems to be not much need for the graph property machinery.
42
+ efficient than C++ templates (but much more readable :-). The second one is even
43
+ more easily implemented using standard iterators with blocks or using the
44
+ {http://www.rubydoc.info/github/monora/stream stream module}. The third one is
45
+ no issue since Ruby is dynamically typed: Each object can be a graph vertex.
46
+ There is no need for a vertex (or even edge type). In the current version of RGL
47
+ properties of vertices are simply attached using hashes. At first there seems to
48
+ be not much need for the graph property machinery.
49
49
 
50
50
  === Algorithms
51
51
 
52
- The first version of RGL only contains a core set of algorithm patterns:
52
+ RGL current contains a core set of algorithm patterns:
53
53
 
54
- * Breadth First Search (RGL::BFSIterator)
55
- * Depth First Search (RGL::DFSIterator)
54
+ * Breadth First Search {RGL::BFSIterator}
55
+ * Depth First Search {RGL::DFSIterator}
56
56
 
57
57
  The algorithm patterns by themselves do not compute any meaningful quantities
58
58
  over graphs, they are merely building blocks for constructing graph
59
59
  algorithms. The graph algorithms in RGL currently include:
60
60
 
61
- * Topological Sort (RGL::TopsortIterator)
62
- * Connected Components (RGL::Graph#each_connected_component)
63
- * Strongly Connected Components (RGL::Graph#strongly_connected_components)
64
- * Transitive Closure (RGL::Graph#transitive_closure)
61
+ * Topological Sort {RGL::TopsortIterator}
62
+ * Connected Components {RGL::Graph#each_connected_component}
63
+ * Strongly Connected Components {RGL::Graph#strongly_connected_components}
64
+ * Transitive Closure {RGL::Graph#transitive_closure}
65
+ * Dijkstras Shortest Path Algorithm {RGL::DijkstraAlgorithm}
66
+ * Bellman Ford Algorithm {RGL::BellmanFordAlgorithm}
65
67
 
66
68
  === Data Structures
67
69
 
68
70
  RGL currently provides two graph classes that implement a generalized adjacency
69
71
  list and an edge list adaptor.
70
72
 
71
- * RGL::AdjacencyGraph
72
- * RGL::ImplicitGraph
73
+ * {RGL::AdjacencyGraph}
74
+ * {RGL::ImplicitGraph}
73
75
 
74
- The AdjacencyGraph class is the general purpose *swiss army knife* of graph
76
+ The AdjacencyGraph class is the general purpose _swiss army knife_ of graph
75
77
  classes. It is highly parameterized so that it can be optimized for different
76
78
  situations: the graph is directed or undirected, allow or disallow parallel
77
79
  edges, efficient access to just the out-edges, fast vertex insertion and removal
@@ -87,75 +89,44 @@ http://www.boost.org/libs/graph/doc/graph_concepts.html.
87
89
 
88
90
  == Installation
89
91
 
90
- RGL is depended on the
91
- stream[http://rgl.rubyforge.org/stream/files/README.html] library which can
92
- also be downloaded from http://rubyforge.org/frs/?group_id=110. If you use gem
93
- to install RGL the stream library will be installed as a prerequisite.
94
-
95
- === GEM Installation
96
-
97
- Download the GEM file and install it with ..
98
-
99
- % gem install rgl-VERSION.gem
100
-
101
- or directly with
102
-
103
92
  % gem install rgl
104
93
 
105
- Use the correct version number for VERSION (e.g. 0.2.x). You may need root
106
- privileges to install.
107
-
108
- === Running tests
94
+ or download the latest sources from the git repository http://github.com/monora/rgl.
109
95
 
110
- RGL comes with a Rakefile which automatically runs the tests. Goto the
111
- installation directory and start rake:
96
+ == Running tests
112
97
 
113
- % gem env
114
- Rubygems Environment:
115
- - VERSION: 0.9.0 (0.9.0)
116
- - INSTALLATION DIRECTORY: /usr/lib/ruby/gems/1.8
117
- - GEM PATH:
118
- - /usr/lib/ruby/gems/1.8
119
- - REMOTE SOURCES:
120
- - http://gems.rubyforge.org
98
+ Checkout RGL git repository and go to the project directory. First, install RGL
99
+ dependencies with bundler:
121
100
 
122
- % cd /usr/lib/ruby/gems/1.8/gems/rgl-0.3.0/
123
- % rake
124
- (in /usr/lib/ruby/gems/1.8/gems/rgl-0.3.0)
125
- /usr/bin/ruby1.8 -Ilib:tests "/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake/rake_test_loader.rb" "tests/TestTransitiveClosure.rb" "tests/TestComponents.rb" "tests/TestCycles.rb" "tests/TestDirectedGraph.rb" "tests/TestEdge.rb" "tests/TestGraph.rb" "tests/TestGraphXML.rb" "tests/TestImplicit.rb" "tests/TestUnDirectedGraph.rb" "tests/TestTraversal.rb" "tests/TestDot.rb" "tests/TestRdot.rb"
126
- Loaded suite /usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake/rake_test_loader
127
- Started
128
- ......................................................................................................................................................
129
- Finished in 0.750958 seconds.
101
+ % bundle install
130
102
 
131
- 86 tests, 625 assertions, 0 failures, 0 errors
132
-
133
- === Code coverage
103
+ After that you can run the tests:
134
104
 
135
- Running rcov[http://eigenclass.org/hiki.rb?rcov] on the test suite generates this[link:coverage/index.html] result.
105
+ % rake test
136
106
 
137
- === Normal Installation
107
+ To see tests coverage run rcov[http://github.com/relevance/rcov] rake task:
138
108
 
139
- You have to install stream library before. You can than install RGL with the
140
- following command:
109
+ % rake rcov
141
110
 
142
- % ruby install.rb
111
+ This command will generate tests coverage report in coverage/ directory.
143
112
 
144
- from its distribution directory. To uninstall it use
145
-
146
- % ruby install.rb -u
113
+ <em>Node: rcov is not compatible with Ruby >= 1.9, so this rake task is
114
+ available only on Ruby 1.8.</em>
147
115
 
148
116
  == Example irb session with RGL
149
117
 
118
+
150
119
  irb> require 'rgl/adjacency'
151
120
  irb> dg=RGL::DirectedAdjacencyGraph[1,2 ,2,3 ,2,4, 4,5, 6,4, 1,6]
152
121
  # Use DOT to visualize this graph:
153
122
  irb> require 'rgl/dot'
154
123
  irb> dg.write_to_graphic_file('jpg')
155
124
  "graph.jpg"
156
-
157
- The result: link:../examples/example.jpg
158
-
125
+
126
+ The result:
127
+
128
+ link:examples/images/example.jpg
129
+
159
130
  irb> dg.directed?
160
131
  true
161
132
  irb> dg.vertices
@@ -189,7 +160,7 @@ Add inverse edge (4-2) to directed graph:
189
160
  irb> dg.remove_edge 4,2
190
161
  true
191
162
 
192
- <em>Topological sort</em> is realized with as iterator:
163
+ <em>Topological sort</em> is implemented as an iterator:
193
164
 
194
165
  require 'rgl/topsort'
195
166
  irb> dg.topsort_iterator.to_a
@@ -197,46 +168,49 @@ Add inverse edge (4-2) to directed graph:
197
168
 
198
169
  A more elaborated example showing <em>implicit graphs</em>:
199
170
 
171
+ require 'rgl/implicit'
200
172
  def module_graph
201
- RGL::ImplicitGraph.new { |g|
202
- g.vertex_iterator { |b|
203
- ObjectSpace.each_object(Module, &b)
204
- }
205
- g.adjacent_iterator { |x, b|
206
- x.ancestors.each { |y|
207
- b.call(y) unless x == y || y == Kernel || y == Object
208
- }
209
- }
210
- g.directed = true
211
- }
173
+ RGL::ImplicitGraph.new { |g|
174
+ g.vertex_iterator { |b|
175
+ ObjectSpace.each_object(Module, &b)
176
+ }
177
+ g.adjacent_iterator { |x, b|
178
+ x.ancestors.each { |y|
179
+ b.call(y) unless x == y || y == Kernel || y == Object
180
+ }
181
+ }
182
+ g.directed = true
183
+ }
212
184
  end
213
185
 
214
186
  This function creates a directed graph, with vertices being all loaded modules:
215
187
 
216
188
  g = module_graph
217
189
 
218
- We only want to see the ancestors of RGL::AdjacencyGraph:
190
+ We only want to see the ancestors of {RGL::AdjacencyGraph}:
219
191
 
220
- tree = bfs_search_tree_from(g,RGL::AdjacencyGraph)
192
+ require 'rgl/traversal'
193
+ tree = g.bfs_search_tree_from(RGL::AdjacencyGraph)
221
194
 
222
195
  Now we want to visualize this component of g with DOT. We therefore create a
223
196
  subgraph of the original graph, using a filtered graph:
224
197
 
225
198
  g = g.vertices_filtered_by {|v| tree.has_vertex? v}
199
+ g.write_to_graphic_file('jpg')
200
+
201
+ creates the following graph image with DOT:
226
202
 
227
- Create the graphics with DOT:
203
+ link:examples/images/module_graph.jpg
228
204
 
229
- g.write_to_graphic_file
205
+ This graph shows all loaded RGL modules:
230
206
 
231
- produces module_graph.jpg: link:../examples/module_graph.jpg
207
+ link:examples/images/rgl_modules.png
232
208
 
233
- Look for more in the examples directory (i.e.
234
- examples.rb[link:files/examples/examples_rb.html]).
209
+ Look for more in _examples_ directory (i.e. {file:examples/examples.rb}).
235
210
 
236
211
  == My del.icio.us links concerning RGL
237
212
 
238
- I collect some links to stuff around RGL at http://del.icio.us/monora/rgl. I
239
- registered RGL at SWiK[http://swik.net/rgl].
213
+ I collect some links to stuff around RGL at http://del.icio.us/monora/rgl.
240
214
 
241
215
  == Credits
242
216
 
@@ -259,18 +233,16 @@ and matz for Ruby. Dave included in the latest version of RDoc (alpha9) the
259
233
  module dot/dot.rb which I use instead of Roberts module to visualize graphs
260
234
  (see rgl/dot.rb).
261
235
 
262
- Jeremy Bopp, John Carter, Sascha Doerdelmann and Shawn Garbett for contributing
263
- additions, test cases and bugfixes.
236
+ Jeremy Bopp, John Carter, Sascha Doerdelmann, Shawn Garbett, Andreas Schörk
237
+ and Kirill Lashuk for contributing additions, test cases and bugfixes.
264
238
 
265
- == Copying
266
-
267
- RGL is Copyright (c) 2002,2004,2005,2008 by Horst Duchene. It is free software, and may be
268
- redistributed under the terms specified in the README file of the Ruby distribution.
239
+ Kirill Lashuk who started to take over further development in November 2012.
269
240
 
270
- == Support
241
+ See also http://github.com/monora/rgl/contributors.
271
242
 
272
- Please contact me at mailto:monora@gmail.com with bug reports
273
- suggestions, and other comments. If you send patches, it would help if
274
- they were in-line (not attachments) and generated using "diff -u".
243
+ == Copying
275
244
 
245
+ RGL is Copyright (c) 2002,2004,2005,2008,2013 by Horst Duchene. It is free software,
246
+ and may be redistributed under the terms specified in the README file of the
247
+ Ruby distribution.
276
248
 
data/Rakefile CHANGED
@@ -1,32 +1,25 @@
1
- # Rakefile for RGL -*- ruby -*-
1
+ # -*- ruby -*-
2
+
3
+ require 'rubygems'
4
+ require 'bundler/setup'
5
+
6
+ require 'rubygems/package_task'
2
7
 
3
- begin
4
- require 'rubygems'
5
- require 'rake/gempackagetask'
6
- rescue Exception
7
- nil
8
- end
9
- require 'rake/clean'
10
8
  require 'rake/testtask'
11
- require 'rake/rdoctask'
12
-
13
- # Determine the current version of the software
14
- rgl_version =
15
- if %x(ruby -Ilib -rrgl/base -e'puts RGL_VERSION') =~ /\S+$/
16
- $&
17
- else
18
- "0.0.0"
19
- end
9
+ require 'rdoc/task'
10
+ require 'yard'
11
+
12
+ $:.unshift File.join(File.dirname(__FILE__), 'lib')
13
+ require 'rgl/base' # require base module to get RGL_VERSION
20
14
 
21
15
  SUMMARY = "Ruby Graph Library"
22
16
  SOURCES = FileList['lib/**/*.rb']
23
- CLOBBER.include('TAGS', 'coverage')
24
17
  RDOC_DIR = './rgl'
25
18
 
26
19
  # The location for published documents to be copied.
27
20
  remote_user = ENV['REMOTE_USER'] || ''
28
- remote_host = ENV['REMOTE_HOST'] || 'rubyforge.org'
29
- remote_path = ENV['REMOTE_PATH'] || '/var/www/gforge-projects/rgl'
21
+ remote_host = ENV['REMOTE_HOST'] || 'github.org'
22
+ remote_path = ENV['REMOTE_PATH'] || 'FIXME'
30
23
  remote_path += '/' unless remote_path[-1, 1] == '/'
31
24
  REMOTE_RDOC_DIR = remote_path
32
25
  REMOTE_RDOC_DIR.insert(
@@ -41,141 +34,51 @@ task :default => :test
41
34
 
42
35
  # Define a test task.
43
36
 
44
- Rake::TestTask.new { |t|
45
- t.libs << "tests"
46
- t.pattern = 'tests/Test*.rb'
37
+ Rake::TestTask.new do |t|
38
+ t.libs << 'test'
39
+ t.pattern = 'test/*_test.rb'
47
40
  t.verbose = true
48
- }
49
-
50
- task :test
51
-
52
- # Define a test that will run all the test targets.
53
- desc "Run all test targets"
54
- task :testall => [:test ]
55
-
56
- desc "Do code coverage with rcov"
57
- task :rcov do
58
- begin
59
- sh 'rcov -Ilib:tests --exclude "tests/.*[tT]est.*.rb,usr.local" tests/Test*rb'
60
- rescue Exception
61
- nil
62
- end
63
41
  end
64
42
 
65
- # Install rgl using the standard install.rb script.
66
-
67
- desc "Install the library"
68
- task :install do
69
- ruby "install.rb"
43
+ begin
44
+ require 'rcov/rcovtask'
45
+
46
+ desc "Calculate code coverage with rcov"
47
+ Rcov::RcovTask.new(:rcov) do |t|
48
+ t.libs << 'test'
49
+ t.pattern = 'test/*_test.rb'
50
+ t.verbose = true
51
+ t.rcov_opts += ['--exclude', 'test/,gems/']
52
+ end
53
+ rescue LoadError
54
+ nil # rcov is available only on Ruby 1.8
70
55
  end
71
56
 
72
- # CVS Tasks ----------------------------------------------------------
57
+ # Git tagging
73
58
 
74
- desc "Tag all the CVS files with the latest release number (TAG=x)"
59
+ desc "Commit all changes as a new version commit. Tag the commit with v<version> tag"
75
60
  task :tag do
76
- rel = "REL_" + rgl_version.gsub(/\./, '_')
77
- rel << ENV['TAG'] if ENV['TAG']
78
- puts rel
79
- sh %{cvs commit -m 'pre-tag commit'}
80
- sh %{cvs tag #{rel}}
81
- end
82
-
83
- desc "Accumulate changelog"
84
- task :changelog do
85
- sh %{cvs2cl --tags --utc --prune --accum}
61
+ puts "Committing and tagging version #{RGL_VERSION}"
62
+ `git commit -am 'Version #{RGL_VERSION}'`
63
+ `git tag 'v#{RGL_VERSION}'`
86
64
  end
87
65
 
88
- # Create a task to build the RDOC documentation tree.
66
+ # Tasks for generating docs.
89
67
 
90
- rd = Rake::RDocTask.new("rdoc") { |rdoc|
68
+ Rake::RDocTask.new("rdoc") do |rdoc|
91
69
  rdoc.rdoc_dir = RDOC_DIR
92
70
  rdoc.template = 'doc/jamis.rb'
93
71
  rdoc.title = SUMMARY
94
- rdoc.options << '--line-numbers' << '--inline-source' << '--main' << 'README'
95
- rdoc.rdoc_files.include(SOURCES, 'README', 'ChangeLog', 'examples/examples.rb', 'rakelib/*.rake')
96
- }
97
-
98
- # ====================================================================
99
- # Create a task that will package the rgl software into distributable
100
- # tar, zip and gem files.
101
-
102
- PKG_FILES = FileList[
103
- 'install.rb',
104
- '[A-Z]*',
105
- 'tests/**/*.rb',
106
- 'examples/**/*',
107
- 'rakelib/*.rake'
108
- ] + SOURCES
109
-
110
- if ! defined?(Gem)
111
- puts "Package Target requires RubyGems"
112
- else
113
- spec = Gem::Specification.new do |s|
114
-
115
- s.name = 'rgl'
116
- s.version = rgl_version
117
- s.summary = SUMMARY
118
-
119
- s.description = <<-EOF
120
- RGL is a framework for graph data structures and algorithms.
121
-
122
- The design of the library is much influenced by the Boost Graph Library (BGL)
123
- which is written in C++ heavily using its template mechanism.
124
-
125
- RGL currently contains a core set of algorithm patterns:
126
-
127
- * Breadth First Search
128
- * Depth First Search
129
-
130
- The algorithm patterns by themselves do not compute any meaningful quantities
131
- over graphs, they are merely building blocks for constructing graph
132
- algorithms. The graph algorithms in RGL currently include:
133
-
134
- * Topological Sort
135
- * Connected Components
136
- * Strongly Connected Components
137
- * Transitive Closure
138
- * Transitive Reduction
139
- * Graph Condensation
140
- * Search cycles (contributed by Shawn Garbett)
141
- EOF
142
-
143
- #### Dependencies and requirements.
144
-
145
- s.add_dependency('stream', '>= 0.5')
146
- s.add_dependency 'rake'
147
- s.requirements << "Stream library, v0.5 or later"
148
-
149
- #### Which files are to be included in this gem? Everything! (Except CVS directories.)
150
- s.files = PKG_FILES.to_a
151
-
152
- #### Load-time details: library and application (you will need one or both).
153
-
154
- s.require_path = 'lib' # Use these for libraries.
155
- s.autorequire = 'rgl/base'
156
-
157
- #### Documentation and testing.
158
-
159
- s.has_rdoc = true
160
- s.extra_rdoc_files = ['README']
161
- s.rdoc_options <<
162
- '--title' << 'RGL - Ruby Graph Library' <<
163
- '--main' << 'README' <<
164
- '--line-numbers'
165
-
166
- #### Author and project details.
167
- s.author = "Horst Duchene"
168
- s.email = "monora@gmail.com"
169
- s.homepage = "http://rgl.rubyforge.org"
170
- s.rubyforge_project = "rgl"
171
- end
172
-
173
- Rake::GemPackageTask.new(spec) do |pkg|
174
- #pkg.need_zip = true
175
- pkg.need_tar = true
176
- end
72
+ rdoc.options << '--line-numbers' << '--inline-source' << '--main' << 'README.rdoc'
73
+ rdoc.rdoc_files.include(SOURCES, 'README.rdoc', 'ChangeLog', 'examples/examples.rb', 'rakelib/*.rake')
177
74
  end
178
75
 
76
+ YARD::Rake::YardocTask.new
77
+
78
+ # Tasks for building and installing RGL gem.
79
+
80
+ Bundler::GemHelper.install_tasks
81
+
179
82
  # TAGS ---------------------------------------------------------------
180
83
 
181
84
  file 'tags' => SOURCES do
@@ -185,7 +88,7 @@ file 'tags' => SOURCES do
185
88
  end
186
89
 
187
90
  file 'TAGS' => SOURCES do
188
- sh %{ctags -e #{SOURCES.join(' ')}} # emacs TAGS
91
+ sh %{etags #{SOURCES.join(' ')}} # emacs TAGS
189
92
  end
190
93
 
191
94
  # Misc tasks =========================================================
@@ -221,12 +124,3 @@ task :lines do
221
124
  end
222
125
  show_line("TOTAL", total_lines, total_code)
223
126
  end
224
-
225
- desc "Copy rdoc html to rubyforge"
226
- task :rdoc2rf => [:rdoc, :rcov, :changelog] do
227
- cp_r 'coverage', RDOC_DIR
228
- examples = File.join(RDOC_DIR, 'examples')
229
- mkdir_p examples
230
- cp Dir.glob('examples/*.jpg'), examples
231
- sh "rsync -r --delete \"#{RDOC_DIR}\" \"#{REMOTE_RDOC_DIR}\""
232
- end