mpath_graph 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c2354a81726eb5b8a4bd80b455cf4af841df2d93
4
- data.tar.gz: 17664de8eb01ccbca0de86129ceb5b6eda0e740e
3
+ metadata.gz: fe98d3cf16c7b1260eec6fe214e67be4bb03581f
4
+ data.tar.gz: 6b63b914bbe6d13531b690b22379326bd2d854a8
5
5
  SHA512:
6
- metadata.gz: 09153a85fff517838307db2ae213e305ce508417f735284b2228acbcaca329428920282c93062d5af7242c31b4bc38803621e2a680be32dabb2e988654eab800
7
- data.tar.gz: 4393b92aa7c38480b58c2870d73e3d7835aea86d83b78542ecfb613478f5265ab90828fb819c28eef426cf0b7853b135a291c3aaf76abf755e25033474d142fc
6
+ metadata.gz: ea44cc2381b1af9bd296ae35d0071fa7de78bbf55d1c3cb054aff0bc285e8728c4d88d04592943f0be8744d01606cfc61367bfe49302bc0ce59786f0288526c9
7
+ data.tar.gz: 2c29f85da657ec31887bcb8eef9afa7679b1f5484037c8ee641e985f57f07fdfb61a5d7981786f83ed7fe458c8cb872a1c43c6584f63977ac1cd839fc583de6c
data/lib/mpath_graph.rb CHANGED
@@ -215,6 +215,13 @@ module MPathGraph
215
215
  options[:initial_vertex] ||= edges[rnd_idx][rnd_idx%2]
216
216
  worm = [options[:initial_vertex]]
217
217
 
218
+ pbar = ProgressBar.create(
219
+ title: "Steps walked",
220
+ starting_at: 0,
221
+ output: STDERR,
222
+ format: "%t |%B| [%c]",
223
+ total: nil)
224
+
218
225
  while worm.size < options[:worm_size]
219
226
  return nil if worm.empty?
220
227
 
@@ -230,6 +237,8 @@ module MPathGraph
230
237
  neighbors = nil
231
238
 
232
239
  if worm.size == options[:worm_size]
240
+ pbar.increment
241
+
233
242
  if is_an_odd_hole?(worm, edges, options[:worm_size])
234
243
  # Check if current hole is also found
235
244
  repeated = false
@@ -1,3 +1,3 @@
1
1
  module MPathGraph
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -38,6 +38,27 @@ class TestMPathGraphOddHole < MiniTest::Unit::TestCase
38
38
  def test_rw_search
39
39
  found = MPathGraph::OddHole::rw_search(@doble_c5, holes_limit: 2)
40
40
  assert_equal 2, found.size
41
+
42
+ # edges = [[1,2],[1,5],[1,6],[1,19],[2,3],[3,4],[3,18],[4,5],
43
+ # [4,9],[4,18],[5,6],[5,7],[6,7],[7,8],[7,10],[8,9],[8,13],
44
+ # [10,11],[10,21],[11,12],[12,13],[13,14],[14,15],[15,16],
45
+ # [16,17],[17,18],[19,20],[20,21]]
46
+
47
+ # options = {worm_size: 5, holes_limit: 2}
48
+ # found = MPathGraph::OddHole::rw_search(edges, options)
49
+ # assert_equal 2, found.size
50
+
51
+ # options = {worm_size: 7, holes_limit: 1}
52
+ # found = MPathGraph::OddHole::rw_search(edges, options)
53
+ # assert_equal 1, found.size
54
+ # assert_empty found.first-[7, 10, 21, 20, 19, 1, 6]
55
+ # assert_empty [7, 10, 21, 20, 19, 1, 6]-found.first
56
+
57
+ # options = {worm_size: 9, holes_limit: 1}
58
+ # found = MPathGraph::OddHole::rw_search(edges, options)
59
+ # assert_equal 1, found.size
60
+ # assert_empty found.first-[18, 4, 9, 8, 13, 14, 15, 16, 17]
61
+ # assert_empty [18, 4, 9, 8, 13, 14, 15, 16, 17]-found.first
41
62
  end
42
63
 
43
64
  def test_equivalents
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mpath_graph
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Israel Buitron
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-13 00:00:00.000000000 Z
11
+ date: 2014-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-progressbar