graphos 0.3.1 → 0.3.2

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: 485ba688a49044d2f348f871a9a86a5e153311d2
4
- data.tar.gz: 7052de8250626dea8ddebe9f13b23bee4f49a257
3
+ metadata.gz: 424ad94d4df8b0deddf12b46bbd544b4978842a7
4
+ data.tar.gz: b3716e933f247c7ff134f781a42c88ab1cd410f7
5
5
  SHA512:
6
- metadata.gz: 7e5ea2654b8cd7fe0274397ae1c200d9d572002a2e4e83cb6f19c694fda020d2c9df0669286faa2131a75844d70623d20cfc90a38f845e026227248913b915b8
7
- data.tar.gz: 89966d08f93340481181609b86d07d6e04d770b5ddbbfb392c76a0b287b6f7e567ad92e6819a1ceed56883a986d82bd4283df77a68bdc77e1448ff52e211c000
6
+ metadata.gz: 5a51e893de68c904c6899cefcd419ccaf51b25f312a7873613fcdfab6ef0f6268a3e9bf088d35810aa6526c463388d1353608c0b0e0f88878a4a9e03a5b061e0
7
+ data.tar.gz: c1bed63d923318218de7da7e72438e1ceb1455a6a91066be364bf84ea3f4c4000b42d96eff907e214245e23ec0fc77a7495a8c285f9056e007c53555a96d4458
@@ -26,21 +26,11 @@ module Graphos
26
26
  end
27
27
 
28
28
  while keyval=heap.pop
29
- # Selecione u em V-S, tal que custo[u] é mínimo
30
29
  idx = keyval.key
31
-
32
- next if visited[idx]
33
-
34
- # Adicione u em S
35
30
  visited[idx] = true
36
-
37
31
  node = graph[idx]
38
-
39
- # Selecione u em V-S, tal que custo[u] é mínimo
40
32
  node.edges.each do |edge|
41
- # Se custo[v] > w((u,v)) então
42
- if costs[edge.to.index] > edge.weight
43
- # custo[v] = w((u,v))
33
+ if !visited[edge.to.index] && costs[edge.to.index] > edge.weight
44
34
  fathers[edge.to.index] = node.index
45
35
  update_cost.call(edge.to.index, edge.weight)
46
36
  end
@@ -50,10 +40,8 @@ module Graphos
50
40
  result = Weighted::Graph.new graph.size
51
41
  fathers.each_with_index do |f,c|
52
42
  if f
53
- if result.edge(f,c)
54
- puts "Existing #{f},#{c}"
55
- end
56
43
  result.add_edge(f, c, costs[c])
44
+ count += 1
57
45
  end
58
46
  end
59
47
  result
@@ -1,4 +1,3 @@
1
- require "algorithms"
2
1
  module Graphos
3
2
  ##
4
3
  # This class represents a collection of edges
@@ -1,3 +1,3 @@
1
1
  module Graphos
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphos
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bernardo Amorim
@@ -94,7 +94,6 @@ files:
94
94
  - LICENSE.txt
95
95
  - README.md
96
96
  - Rakefile
97
- - graphos-0.3.0.gem
98
97
  - graphos.gemspec
99
98
  - lib/graphos.rb
100
99
  - lib/graphos/algorithm/dijkstra.rb
Binary file