rgl 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog CHANGED
@@ -1,3 +1,42 @@
1
+ 2015-12 Release 0.5.1
2
+
3
+ Horst Duchene <monora@gmail.com>
4
+ * Changed edge sequence to match example picture (daa88e)
5
+
6
+ Chase <chase.gilliam@gmail.com>
7
+ * updated algorithms to 6.1 and added test unit to support newer rubies (fbd874)
8
+
9
+ Louis Rose <louismrose@gmail.com>
10
+ * Fix #15. Use object IDs rather than labels to identify vertexs in DOT graph
11
+ to ensure that distinct nodes that share a label are shown. (33206f, 4fc455)
12
+
13
+ 2014-12 Release 0.5.0
14
+
15
+ Horst Duchene <monora@gmail.com>
16
+ * Changed edge sequence to match example picture (daa88e)
17
+ * Fixed comment (6a6c93)
18
+ * Fixed spelling (7ca281)
19
+ Horst Duchêne <monora@gmail.com>
20
+ Chase <chase.gilliam@gmail.com>
21
+ * updated algorithms to 6.1 and added test unit to support newer rubies (fbd874)
22
+ Louis Rose <louismrose@gmail.com>
23
+ * Fix #15. Use object IDs rather than labels to identify vertexs in DOT graph to ensure that distinct nodes that share a label are shown. (33206f)
24
+ * Issue #15. Fix tests. (4fc455)
25
+
26
+
27
+ 2014-12 Release 0.5.0
28
+ Horst Duchene <monora@gmail.com>
29
+ * Changed edge sequence to match example picture (daa88e)
30
+ * Fixed comment (6a6c93)
31
+ * Fixed spelling (7ca281)
32
+ Horst Duchêne <monora@gmail.com>
33
+ Chase <chase.gilliam@gmail.com>
34
+ * updated algorithms to 6.1 and added test unit to support newer rubies (fbd874)
35
+ Louis Rose <louismrose@gmail.com>
36
+ * Fix #15. Use object IDs rather than labels to identify vertexs in DOT graph to ensure that distinct nodes that share a label are shown. (33206f)
37
+ * Issue #15. Fix tests. (4fc455)
38
+
39
+
1
40
  2014-12 Release 0.5.0
2
41
 
3
42
  This release mainly contains the contributions of Kirill, who added many algorithms to the library. Thank you Kirill!
data/Gemfile CHANGED
@@ -1,3 +1,7 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
+
5
+ gem 'rake'
6
+ gem 'yard'
7
+ gem 'asciidoctor'
@@ -18,10 +18,10 @@ Ruby. The main design goals directly taken from the BGL design are:
18
18
 
19
19
  * An interface for how the structure of a graph can be accessed using a generic
20
20
  interface that hides the details of the graph data structure
21
- implementation. This interface is defined by the module Graph, which should be
21
+ implementation. This interface is defined by the module {Graph}, which should be
22
22
  included in concrete classes.
23
23
 
24
- * A standardized generic interface for traversing graphs (RGL::GraphIterator)
24
+ * A standardized generic interface for traversing graphs {RGL::GraphIterator}
25
25
 
26
26
  RGL provides some general purpose graph classes that conform to this interface,
27
27
  but they are not meant to be the *only* graph classes. As in BGL I believe that
@@ -125,7 +125,7 @@ available only on Ruby 1.8.</em>
125
125
 
126
126
  The result:
127
127
 
128
- link:examples/images/example.jpg
128
+ link:images/example.jpg
129
129
 
130
130
  irb> dg.directed?
131
131
  true
@@ -200,11 +200,11 @@ subgraph of the original graph, using a filtered graph:
200
200
 
201
201
  creates the following graph image with DOT:
202
202
 
203
- link:examples/images/module_graph.jpg
203
+ link:images/module_graph.jpg
204
204
 
205
205
  This graph shows all loaded RGL modules:
206
206
 
207
- link:examples/images/rgl_modules.png
207
+ link:images/rgl_modules.png
208
208
 
209
209
  Look for more in _examples_ directory (i.e. {file:examples/examples.rb}).
210
210
 
@@ -242,7 +242,7 @@ See also http://github.com/monora/rgl/contributors.
242
242
 
243
243
  == Copying
244
244
 
245
- RGL is Copyright (c) 2002,2004,2005,2008,2013 by Horst Duchene. It is free software,
245
+ RGL is Copyright (c) 2002,2004,2005,2008,2013,2015 by Horst Duchene. It is free software,
246
246
  and may be redistributed under the terms specified in the README file of the
247
247
  Ruby distribution.
248
248
 
data/Rakefile CHANGED
@@ -6,7 +6,6 @@ require 'bundler/setup'
6
6
  require 'rubygems/package_task'
7
7
 
8
8
  require 'rake/testtask'
9
- require 'rdoc/task'
10
9
  require 'yard'
11
10
 
12
11
  $:.unshift File.join(File.dirname(__FILE__), 'lib')
@@ -14,21 +13,8 @@ require 'rgl/base' # require base module to get RGL_VERSION
14
13
 
15
14
  SUMMARY = "Ruby Graph Library"
16
15
  SOURCES = FileList['lib/**/*.rb']
17
- RDOC_DIR = './rgl'
18
-
19
- # The location for published documents to be copied.
20
- remote_user = ENV['REMOTE_USER'] || ''
21
- remote_host = ENV['REMOTE_HOST'] || 'github.org'
22
- remote_path = ENV['REMOTE_PATH'] || 'FIXME'
23
- remote_path += '/' unless remote_path[-1, 1] == '/'
24
- REMOTE_RDOC_DIR = remote_path
25
- REMOTE_RDOC_DIR.insert(
26
- 0,
27
- remote_user + (remote_user.empty? ? '' : '@') + remote_host + ':'
28
- ) unless remote_host.empty?
29
16
 
30
17
  # The default task is run if rake is given no explicit arguments.
31
-
32
18
  desc "Default Task"
33
19
  task :default => :test
34
20
 
@@ -63,16 +49,6 @@ task :tag do
63
49
  `git tag 'v#{RGL_VERSION}'`
64
50
  end
65
51
 
66
- # Tasks for generating docs.
67
-
68
- Rake::RDocTask.new("rdoc") do |rdoc|
69
- rdoc.rdoc_dir = RDOC_DIR
70
- rdoc.template = 'doc/jamis.rb'
71
- rdoc.title = SUMMARY
72
- rdoc.options << '--line-numbers' << '--inline-source' << '--main' << 'README.rdoc'
73
- rdoc.rdoc_files.include(SOURCES, 'README.rdoc', 'ChangeLog', 'examples/examples.rb', 'rakelib/*.rake')
74
- end
75
-
76
52
  YARD::Rake::YardocTask.new
77
53
 
78
54
  # Tasks for building and installing RGL gem.
@@ -124,3 +100,31 @@ task :lines do
124
100
  end
125
101
  show_line("TOTAL", total_lines, total_code)
126
102
  end
103
+
104
+ # simple rake task to output a changelog between two commits, tags ...
105
+ # output is formatted simply, commits are grouped under each author name
106
+ #
107
+ desc "generate changelog with nice clean output"
108
+ task :changelog, :since_c, :until_c do |t,args|
109
+ since_c = args[:since_c] || `git tag | tail -1`.chomp
110
+ until_c = args[:until_c]
111
+ cmd=`git log --pretty='format:%ci::%an <%ae>::%s::%H' #{since_c}..#{until_c}`
112
+
113
+ entries = Hash.new
114
+ changelog_content = String.new
115
+
116
+ cmd.split("\n").each do |entry|
117
+ date, author, subject, hash = entry.chomp.split("::")
118
+ entries[author] = Array.new unless entries[author]
119
+ day = date.split(" ").first
120
+ entries[author] << "#{subject} (#{hash[0..5]})" unless subject =~ /Merge/
121
+ end
122
+
123
+ # generate clean output
124
+ entries.keys.each do |author|
125
+ changelog_content += author + "\n"
126
+ entries[author].reverse.each { |entry| changelog_content += " * #{entry}\n" }
127
+ end
128
+
129
+ puts changelog_content
130
+ end
@@ -6,7 +6,7 @@
6
6
 
7
7
  require 'rgl/enumerable_ext'
8
8
 
9
- RGL_VERSION = "0.5.0"
9
+ RGL_VERSION = "0.5.1"
10
10
 
11
11
  module RGL
12
12
  class NotDirectedError < RuntimeError; end
@@ -12,6 +12,11 @@ module RGL
12
12
 
13
13
  module Graph
14
14
 
15
+ # Returns a label for vertex v. Default is v.to_s
16
+ def vertex_label(v)
17
+ v.to_s
18
+ end
19
+
15
20
  # Return a RGL::DOT::Digraph for directed graphs or a DOT::Graph for an
16
21
  # undirected Graph. _params_ can contain any graph property specified in
17
22
  # rdot.rb.
@@ -23,18 +28,17 @@ module RGL
23
28
  edge_class = directed? ? DOT::DirectedEdge : DOT::Edge
24
29
 
25
30
  each_vertex do |v|
26
- name = v.to_s
27
31
  graph << DOT::Node.new(
28
- 'name' => name,
32
+ 'name' => v.object_id,
29
33
  'fontsize' => fontsize,
30
- 'label' => name
34
+ 'label' => vertex_label(v)
31
35
  )
32
36
  end
33
37
 
34
38
  each_edge do |u, v|
35
39
  graph << edge_class.new(
36
- 'from' => u.to_s,
37
- 'to' => v.to_s,
40
+ 'from' => u.object_id,
41
+ 'to' => v.object_id,
38
42
  'fontsize' => fontsize
39
43
  )
40
44
  end
@@ -3,7 +3,7 @@ require 'rgl/graph_wrapper'
3
3
  module RGL
4
4
 
5
5
  # Module GraphVisitor defines the BGL
6
- # BFS[http://www.boost.org/libs/graph/doc/BFSVisitor.html] Visitor Concept).
6
+ # BFS[http://www.boost.org/libs/graph/doc/BFSVisitor.html] Visitor Concept.
7
7
  #
8
8
  # Visitors provide a mechanism for extending an algorithm (i.e., for
9
9
  # customizing what is done at each step of the algorithm). They allow users
@@ -13,14 +13,22 @@ class TestDot < Test::Unit::TestCase
13
13
  graph = RGL::DirectedAdjacencyGraph[1, 2]
14
14
  dot = graph.to_dot_graph.to_s
15
15
 
16
+ first_vertex_id = 1.object_id
17
+ second_vertex_id = 2.object_id
18
+
16
19
  assert_match(dot, /\{[^}]*\}/) # {...}
17
- assert_match(dot, /1\s*\[/) # node 1
18
- assert_match(dot, /2\s*\[/) # node 2
19
- assert_match(dot, /1\s*->\s*2/) # edge
20
+ assert_match(dot, /#{first_vertex_id}\s*\[/) # node 1
21
+ assert_match(dot, /label\s*=\s*1/) # node 1 label
22
+ assert_match(dot, /#{second_vertex_id}\s*\[/) # node 2
23
+ assert_match(dot, /label\s*=\s*2/) # node 2 label
24
+ assert_match(dot, /#{first_vertex_id}\s*->\s*#{second_vertex_id}/) # edge
20
25
  end
21
26
 
22
27
  def test_to_dot_graph
23
28
  graph = RGL::AdjacencyGraph[1, 2]
24
- dot = graph.write_to_graphic_file
29
+ def graph.vertex_label(v)
30
+ "label-"+v.to_s
31
+ end
32
+ dot = graph.write_to_graphic_file
25
33
  end
26
34
  end
@@ -11,7 +11,7 @@ class TestTraversal < Test::Unit::TestCase
11
11
 
12
12
  def setup
13
13
  @dg = DirectedAdjacencyGraph.new(Array)
14
- edges = [[1, 2], [2, 3], [2, 4], [4, 5], [1, 6], [6, 4]]
14
+ edges = [[1, 2], [1, 6], [2, 3], [2, 4], [4, 5], [6, 4]]
15
15
  edges.each do |(src, target)|
16
16
  @dg.add_edge(src, target)
17
17
  end
@@ -155,7 +155,7 @@ END
155
155
  ts_order = ts_it.to_a # do the traversal
156
156
  assert_equal(@dg.num_vertices, ts_order.size)
157
157
 
158
- # Check topsort contraint:
158
+ # Check topsort constraint:
159
159
  @dg.each_edge { |u, v|
160
160
  assert(ts_order.index(u) < ts_order.index(v))
161
161
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rgl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire: rgl/base
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-12-15 00:00:00.000000000 Z
13
+ date: 2015-07-25 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: stream
@@ -35,7 +35,7 @@ dependencies:
35
35
  requirements:
36
36
  - - ~>
37
37
  - !ruby/object:Gem::Version
38
- version: 0.5.0
38
+ version: 0.6.1
39
39
  type: :runtime
40
40
  prerelease: false
41
41
  version_requirements: !ruby/object:Gem::Requirement
@@ -43,7 +43,7 @@ dependencies:
43
43
  requirements:
44
44
  - - ~>
45
45
  - !ruby/object:Gem::Version
46
- version: 0.5.0
46
+ version: 0.6.1
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rake
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -61,7 +61,7 @@ dependencies:
61
61
  - !ruby/object:Gem::Version
62
62
  version: '0'
63
63
  - !ruby/object:Gem::Dependency
64
- name: rdoc
64
+ name: yard
65
65
  requirement: !ruby/object:Gem::Requirement
66
66
  none: false
67
67
  requirements:
@@ -77,7 +77,7 @@ dependencies:
77
77
  - !ruby/object:Gem::Version
78
78
  version: '0'
79
79
  - !ruby/object:Gem::Dependency
80
- name: yard
80
+ name: test-unit
81
81
  requirement: !ruby/object:Gem::Requirement
82
82
  none: false
83
83
  requirements:
@@ -131,7 +131,6 @@ files:
131
131
  - examples/images/rgl_modules.png
132
132
  - examples/insel_der_tausend_gefahren.rb
133
133
  - examples/rdep-rgl.rb
134
- - examples/graph.dot
135
134
  - examples/north2.rb
136
135
  - examples/canvas.rb
137
136
  - examples/north.rb
@@ -245,7 +244,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
245
244
  version: '0'
246
245
  segments:
247
246
  - 0
248
- hash: -105297123
247
+ hash: 900116365
249
248
  required_rubygems_version: !ruby/object:Gem::Requirement
250
249
  none: false
251
250
  requirements:
@@ -254,7 +253,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
254
253
  version: '0'
255
254
  segments:
256
255
  - 0
257
- hash: -105297123
256
+ hash: 900116365
258
257
  requirements: []
259
258
  rubyforge_project:
260
259
  rubygems_version: 1.8.23
@@ -1,46 +0,0 @@
1
- subgraph RGL__AdjacencyGraph {
2
- 0 [
3
- fontsize = 8,
4
- label = 0
5
- ]
6
-
7
- 1 [
8
- fontsize = 8,
9
- label = 1
10
- ]
11
-
12
- 2 [
13
- fontsize = 8,
14
- label = 2
15
- ]
16
-
17
- 3 [
18
- fontsize = 8,
19
- label = 3
20
- ]
21
-
22
- 4 [
23
- fontsize = 8,
24
- label = 4
25
- ]
26
-
27
- 0 -- 1 [
28
- fontsize = 8
29
- ]
30
-
31
- 0 -- 4 [
32
- fontsize = 8
33
- ]
34
-
35
- 1 -- 2 [
36
- fontsize = 8
37
- ]
38
-
39
- 2 -- 3 [
40
- fontsize = 8
41
- ]
42
-
43
- 3 -- 4 [
44
- fontsize = 8
45
- ]
46
- }