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 +4 -4
- data/lib/graphos/algorithm/prim.rb +2 -14
- data/lib/graphos/path.rb +0 -1
- data/lib/graphos/version.rb +1 -1
- metadata +1 -2
- data/graphos-0.3.0.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 424ad94d4df8b0deddf12b46bbd544b4978842a7
|
4
|
+
data.tar.gz: b3716e933f247c7ff134f781a42c88ab1cd410f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
data/lib/graphos/path.rb
CHANGED
data/lib/graphos/version.rb
CHANGED
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.
|
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
|
data/graphos-0.3.0.gem
DELETED
Binary file
|