rgl 0.5.2 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d301ca82307bce4dd2de05303de4bc633f92dbf4
4
- data.tar.gz: a133f96bc69d3baa7a790674fd9d6e08a8b93d83
3
+ metadata.gz: c15acc14278cf56aa4c7bb4de7e65944a7a12fb9
4
+ data.tar.gz: 718389d3eb3cf3decb71fe37be4a33fdc17c42be
5
5
  SHA512:
6
- metadata.gz: 88d2fcb68bfc33c482cc11d0c82ac8c143ac9d2fcd1f4c287f3392944fc7ca212dd9f93bed4654a243c4ab9d73038d9c3c34dcd84e1521923756e8833e69963d
7
- data.tar.gz: ffe9faef0d0e4f77cef5c830a3ef0a86b2fe61bb8ad7e8f62c272c9360d550e24aca23c5aaf392f9f6990cdf1e36e9d631dab7d982ff1c8b89823eecc4c39042
6
+ metadata.gz: ee20512b191bc19d6bf702884ac7edcd3522a71248373bb11c0ebe5821388c2245fd8fcbaecdf4c95cfb51df9ea52f6eece56e420a9b56345644f684449dd421
7
+ data.tar.gz: 4f3e57edb2a8521713bf2171a12cd4683f02e16c5b01ed8b18db25a08d5e5fe54039580c648616f395a506e1919e722852ec648cc80d0c9f6feb0a80aece7fcd
data/ChangeLog CHANGED
@@ -1,50 +1,59 @@
1
+ 2016-05 Release 0.5.3
2
+
3
+ Horst Duchene
4
+ * Issue #38: Add error handling or dot functions. (719e38, 5a3423)
5
+ Thomas Orozco
6
+ * Remove Enumerable Extension (fde8a5)
7
+ * Update to codeclimate-test-reporter 1.x (25fdb5)
8
+ Mario Daskalov
9
+ * Clarify that you need graphviz in the README (35a4b4)
10
+
1
11
  2016-05 Release 0.5.2
2
12
 
3
- Horst Duchene <monora@gmail.com>
13
+ Horst Duchene
4
14
  * Issue #21: Use new method vertex_id instead of object_id to identify vertices in dot export. (fa7592)
5
15
  * Integrate Code Climate's test coverage reporting (0ab722)
6
16
  * Clarify traversal order of DFS search (see #20). (afa788)
7
- Chase Gilliam <chase.gilliam@gmail.com>
17
+ Chase Gilliam
8
18
  * drop 1.9.3 add newer jruby and rubinius (fad333)
9
- Matías Battocchia <matias@riseup.net>
19
+ Matías Battocchia
10
20
  * Switched to a different heap implementation. (bd7c13)
11
- gorn <j@kub.cz>
21
+ gorn
12
22
  * Adding failing test for issue #24 (1f6204)
13
23
 
14
24
  2015-12 Release 0.5.1
15
25
 
16
- Horst Duchene <monora@gmail.com>
26
+ Horst Duchene
17
27
  * Changed edge sequence to match example picture (daa88e)
18
28
 
19
- Chase <chase.gilliam@gmail.com>
29
+ Chase
20
30
  * updated algorithms to 6.1 and added test unit to support newer rubies (fbd874)
21
31
 
22
- Louis Rose <louismrose@gmail.com>
32
+ Louis Rose
23
33
  * Fix #15. Use object IDs rather than labels to identify vertexs in DOT graph
24
34
  to ensure that distinct nodes that share a label are shown. (33206f, 4fc455)
25
35
 
26
36
  2014-12 Release 0.5.0
27
37
 
28
- Horst Duchene <monora@gmail.com>
38
+ Horst Duchene
29
39
  * Changed edge sequence to match example picture (daa88e)
30
40
  * Fixed comment (6a6c93)
31
41
  * Fixed spelling (7ca281)
32
- Horst Duchêne <monora@gmail.com>
33
- Chase <chase.gilliam@gmail.com>
42
+ Horst Duchêne
43
+ Chase
34
44
  * updated algorithms to 6.1 and added test unit to support newer rubies (fbd874)
35
- Louis Rose <louismrose@gmail.com>
45
+ Louis Rose
36
46
  * 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
47
  * Issue #15. Fix tests. (4fc455)
38
48
 
39
-
40
49
  2014-12 Release 0.5.0
41
- Horst Duchene <monora@gmail.com>
50
+ Horst Duchene
42
51
  * Changed edge sequence to match example picture (daa88e)
43
52
  * Fixed comment (6a6c93)
44
53
  * Fixed spelling (7ca281)
45
- Chase <chase.gilliam@gmail.com>
54
+ Chase
46
55
  * updated algorithms to 6.1 and added test unit to support newer rubies (fbd874)
47
- Louis Rose <louismrose@gmail.com>
56
+ Louis Rose
48
57
  * Fix #15. Use object IDs rather than labels to identify vertexs
49
58
  in DOT graph to ensure that distinct nodes that share a label are
50
59
  shown. (33206f)
data/Gemfile CHANGED
@@ -2,4 +2,7 @@ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
5
- gem "codeclimate-test-reporter", group: :test, require: nil
5
+ group :test do
6
+ gem "simplecov"
7
+ gem "codeclimate-test-reporter", "~> 1.0.0"
8
+ end
data/README.md CHANGED
@@ -1,4 +1,4 @@
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) [<img src="https://codeclimate.com/github/monora/rgl/badges/coverage.svg" />](https://codeclimate.com/github/monora/rgl/coverage)
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) [<img src="https://codeclimate.com/github/monora/rgl/badges/coverage.svg" />](https://codeclimate.com/github/monora/rgl/coverage) [<img src="https://badge.fury.io/rb/rgl.svg" alt="Version"/>](https://badge.fury.io/rb/rgl)
2
2
 
3
3
  RGL is a framework for graph data structures and algorithms.
4
4
 
@@ -108,6 +108,8 @@ the base module Graph. The complexity guarantees can not necessarily provided.
108
108
  or download the latest sources from the git repository
109
109
  http://github.com/monora/rgl.
110
110
 
111
+ If you are going to use the drawing functionalities install [Graphviz](http://www.graphviz.org/).
112
+
111
113
  ## Running tests
112
114
 
113
115
  Checkout RGL git repository and go to the project directory. First, install
@@ -225,8 +227,8 @@ graph resources.
225
227
 
226
228
  Robert kindly allowed to integrate his work on graphr, which I did not yet
227
229
  succeed. Especially his work to output graphs for
228
- [GraphViz](http://www.research.att.com/sw/tools/graphviz/download.html) is
229
- much more elaborated than the minimal support in dot.rb.
230
+ [GraphViz](http://www.graphviz.org) is much more elaborated than the minimal
231
+ support in dot.rb.
230
232
 
231
233
  Jeremy Siek one of the authors of the nice book [The Boost Graph
232
234
  Library](http://www.boost.org/libs/graph/doc) kindly allowed to use the BGL
data/Rakefile CHANGED
@@ -100,9 +100,8 @@ task :changelog, :since_c, :until_c do |t,args|
100
100
  changelog_content = String.new
101
101
 
102
102
  cmd.split("\n").each do |entry|
103
- date, author, subject, hash = entry.chomp.split("::")
103
+ _, author, subject, hash = entry.chomp.split("::")
104
104
  entries[author] = Array.new unless entries[author]
105
- day = date.split(" ").first
106
105
  entries[author] << "#{subject} (#{hash[0..5]})" unless subject =~ /Merge/
107
106
  end
108
107
 
@@ -4,9 +4,7 @@
4
4
  # library. The main module is RGL::Graph which defines the abstract behavior of
5
5
  # all graphs in the library.
6
6
 
7
- require 'rgl/enumerable_ext'
8
-
9
- RGL_VERSION = "0.5.2"
7
+ RGL_VERSION = "0.5.3"
10
8
 
11
9
  module RGL
12
10
  class NotDirectedError < RuntimeError; end
@@ -22,7 +22,7 @@ module RGL
22
22
  next if bfs.finished_vertex?(u)
23
23
 
24
24
  bfs.reset_start(u)
25
- bfs.move_forward_until { @found_odd_cycle }
25
+ bfs.move_forward_until { bfs.found_odd_cycle }
26
26
 
27
27
  return if bfs.found_odd_cycle
28
28
  end
@@ -84,4 +84,4 @@ module RGL
84
84
 
85
85
  end # class BipartiteBFSIterator
86
86
 
87
- end # module RGL
87
+ end # module RGL
@@ -5,6 +5,9 @@
5
5
  # Minimal Dot support, based on Dave Thomas's dot module (included in rdoc).
6
6
  # rdot.rb is a modified version which also contains support for undirected
7
7
  # graphs.
8
+ #
9
+ # You need to have [GraphViz](http://www.graphviz.org) installed, because the
10
+ # functions in this modul execute the GraphViz executables _dot_ or _dotty_.
8
11
 
9
12
  require 'rgl/rdot'
10
13
 
@@ -64,7 +67,9 @@ module RGL
64
67
  File.open(dotfile, "w") do |f|
65
68
  print_dotted_on(params, f)
66
69
  end
67
- system("dotty", dotfile)
70
+ unless system("dotty", dotfile)
71
+ raise "Error executing dotty. Did you install GraphViz?"
72
+ end
68
73
  end
69
74
 
70
75
  # Use dot[http://www.graphviz.org] to create a graphical representation of
@@ -78,7 +83,9 @@ module RGL
78
83
  f << self.to_dot_graph.to_s << "\n"
79
84
  end
80
85
 
81
- system("dot -T#{fmt} #{src} -o #{dot}")
86
+ unless system("dot -T#{fmt} #{src} -o #{dot}")
87
+ raise "Error executing dot. Did you install GraphViz?"
88
+ end
82
89
  dot
83
90
  end
84
91
 
@@ -46,9 +46,9 @@ module RGL
46
46
  min_residual_capacity = [min_residual_capacity, @residual_capacity_map[u, v]].min
47
47
  end
48
48
 
49
- augmenting_path.each_cons(2) do |(u, v)|
50
- @flow_map[[u, v]] += min_residual_capacity
51
- @flow_map[[v, u]] -= min_residual_capacity
49
+ augmenting_path.each_cons(2) do |(uu, vv)|
50
+ @flow_map[[uu, vv]] += min_residual_capacity
51
+ @flow_map[[vv, uu]] -= min_residual_capacity
52
52
  end
53
53
  end
54
54
  end
@@ -133,4 +133,4 @@ module RGL
133
133
 
134
134
  end # module Graph
135
135
 
136
- end
136
+ end
@@ -10,6 +10,10 @@ module RGL
10
10
  module GraphIterator
11
11
  include Stream
12
12
  include GraphWrapper
13
+
14
+ def length
15
+ inject(0) { |sum| sum + 1 }
16
+ end
13
17
  end
14
18
 
15
19
  end # RGL
@@ -61,7 +61,7 @@ i -> h j e c
61
61
 
62
62
  assert_equal(4, vis.num_comp)
63
63
 
64
- res = vis.comp_map.to_a.sort.reduce({}) { |res, a|
64
+ result = vis.comp_map.to_a.sort.reduce({}) { |res, a|
65
65
  if res.key?(a[1])
66
66
  res[a[1]] << a[0]
67
67
  else
@@ -70,7 +70,7 @@ i -> h j e c
70
70
  res
71
71
  }
72
72
 
73
- std_res = res.to_a.map {
73
+ std_res = result.to_a.map {
74
74
  |a|
75
75
  [a[1][0], a[1]]
76
76
  }.sort
@@ -11,17 +11,22 @@ class TestDot < Test::Unit::TestCase
11
11
 
12
12
  def test_to_dot_digraph
13
13
  graph = RGL::DirectedAdjacencyGraph["a", "b"]
14
- dot = graph.to_dot_graph.to_s
15
14
 
16
- first_vertex_id = "a"
17
- second_vertex_id = "b"
15
+ begin
16
+ dot = graph.to_dot_graph.to_s
18
17
 
19
- assert_match(dot, /\{[^}]*\}/) # {...}
20
- assert_match(dot, /#{first_vertex_id}\s*\[/) # node 1
21
- assert_match(dot, /label\s*=\s*a/) # node 1 label
22
- assert_match(dot, /#{second_vertex_id}\s*\[/) # node 2
23
- assert_match(dot, /label\s*=\s*b/) # node 2 label
24
- assert_match(dot, /#{first_vertex_id}\s*->\s*#{second_vertex_id}/) # edge
18
+ first_vertex_id = "a"
19
+ second_vertex_id = "b"
20
+
21
+ assert_match(dot, /\{[^}]*\}/) # {...}
22
+ assert_match(dot, /#{first_vertex_id}\s*\[/) # node 1
23
+ assert_match(dot, /label\s*=\s*a/) # node 1 label
24
+ assert_match(dot, /#{second_vertex_id}\s*\[/) # node 2
25
+ assert_match(dot, /label\s*=\s*b/) # node 2 label
26
+ assert_match(dot, /#{first_vertex_id}\s*->\s*#{second_vertex_id}/) # edge
27
+ rescue
28
+ puts "Graphviz not installed?"
29
+ end
25
30
  end
26
31
 
27
32
  def test_to_dot_graph
@@ -33,6 +38,10 @@ class TestDot < Test::Unit::TestCase
33
38
  def graph.vertex_id(v)
34
39
  "id-"+v.to_s
35
40
  end
36
- dot = graph.write_to_graphic_file
41
+ begin
42
+ graph.write_to_graphic_file
43
+ rescue
44
+ puts "Graphviz not installed?"
45
+ end
37
46
  end
38
47
  end
@@ -31,7 +31,7 @@ class TestGraphXML < Test::Unit::TestCase
31
31
  name, nnodes, nedges = $1, $2.to_i, $3.to_i
32
32
  end
33
33
  if name && /directed: (\w+).*acyclic: (\w+).*connected: (\w+).*biconnected: (\w+)\s+/ =~ line
34
- directed, acyclic, connected, biconnected = $1, $2, $3, $4
34
+ directed, acyclic, connected = $1, $2, $3
35
35
  File.open(NORTH_DIR + name + '.graphml') {
36
36
  |file|
37
37
  print '.'; $stdout.flush
@@ -44,12 +44,6 @@ class TestGraphXML < Test::Unit::TestCase
44
44
  num_comp = 0
45
45
  graph.to_undirected.each_connected_component { |x| num_comp += 1 }
46
46
  assert_equal(connected, (num_comp == 1).to_s)
47
-
48
- # if graph.directed?
49
- # num_comp = graph.strongly_connected_components.num_comp
50
- # #puts num_comp
51
- # assert_equal(biconnected, (num_comp == 1).to_s)
52
- # end
53
47
  }
54
48
  end
55
49
  }
@@ -1,5 +1,5 @@
1
- require "codeclimate-test-reporter"
2
- CodeClimate::TestReporter.start
1
+ require 'simplecov'
2
+ SimpleCov.start
3
3
 
4
4
  require 'rubygems'
5
5
  require 'test/unit'
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.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Horst Duchene
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire: rgl/base
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-05-09 00:00:00.000000000 Z
12
+ date: 2017-04-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: stream
@@ -107,7 +107,6 @@ files:
107
107
  - lib/rgl/base.rb
108
108
  - lib/rgl/dot.rb
109
109
  - lib/rgl/graph_iterator.rb
110
- - lib/rgl/enumerable_ext.rb
111
110
  - lib/rgl/dijkstra_visitor.rb
112
111
  - lib/rgl/mutable.rb
113
112
  - lib/rgl/connected_components.rb
@@ -189,6 +188,7 @@ files:
189
188
  - examples/north/g.10.2.graphml
190
189
  - examples/examples.rb
191
190
  - Gemfile
191
+ - README.md
192
192
  - Rakefile
193
193
  - rakelib/dep_graph.rake
194
194
  - test/dijkstra_test.rb
@@ -211,7 +211,6 @@ files:
211
211
  - test/test_helper.rb
212
212
  - test/transitivity_test.rb
213
213
  - test/bipartite_test.rb
214
- - README.md
215
214
  homepage: https://github.com/monora/rgl
216
215
  licenses: []
217
216
  metadata: {}
@@ -1,16 +0,0 @@
1
- module Enumerable
2
-
3
- # Fixnum()
4
- #
5
- # Return the number of elements of the Enumerable. Same as _size_ but not all
6
- # Enumerables implement size.
7
- #--
8
- # Should we call the methods _size_?
9
- #
10
- def length
11
- inject(0) do |sum, v|
12
- sum + 1
13
- end
14
- end
15
-
16
- end