shortest_path 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.rspec +1 -0
- data/README.md +1 -1
- data/lib/shortest_path/finder.rb +4 -2
- data/lib/shortest_path/version.rb +1 -1
- data/spec/shortest_path/finder_spec.rb +5 -5
- metadata +6 -25
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
MzcwZTljMmViZTdmMDQxMWNlNWY4ODEyNGFkYTA2NDNhY2ZlZmFkYQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
YzZkODI5Nzg4NzkwYmNkZGY1NWMzZTFlODFlYzUwNTI5YzczYmEzNg==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
M2M5ZmE4MDFhY2ZkYjdjN2EzMmZjMmY0MTM2Nzc4OGY5YzVjYzNkODhiYjkw
|
10
|
+
OTcxMDEyMzYwZGI1MTIzN2Y0ZTExNWU3NTg0ODg5OWFiM2EzOWM0ZmI3Nzkw
|
11
|
+
NWQ0NTg4MjU2MWY0MzA3NWFkN2E4NDE0MDMyMTUyZmYzZTYyYjI=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ZDdiYmVmMWFkM2UyMzY1NWFlNDNjNWNlMDYwYjE5ZmZhMzVhZDg0NTI5MDFk
|
14
|
+
OWQ5NmEwZWY3NjE1NWVmMTIwNWQxYWFkNjk1ZDUyYWI0NjkxODAyNzgwODJk
|
15
|
+
ZDQwYzYwMzk3ZjlhMjMzNTFmNjlhNDczOGU4ZDgzNGVhMjkwMjM=
|
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--colour
|
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# Shortest Path
|
2
|
-
[![Build Status](https://travis-ci.org/
|
2
|
+
[![Build Status](https://travis-ci.org/cityway-transdev/shortest_path.svg?branch=master)](http://travis-ci.org/cityway-transdev/shortest_path) [![Dependency Status](https://gemnasium.com/cityway-transdev/shortest_path.png)](https://gemnasium.com/cityway-transdev/shortest_path) [![Code Climate](https://codeclimate.com/github/cityway-transdev/shortest_path.png)](https://codeclimate.com/github/cityway-transdev/shortest_path) [![Coverage Status](https://img.shields.io/coveralls/cityway-transdev/shortest_path.svg)](https://coveralls.io/r/cityway-transdev/shortest_path)
|
3
3
|
|
4
4
|
A* ruby implementation to find shortest path and map in a graph with :
|
5
5
|
- a timeout to stop research when duration > timeout
|
data/lib/shortest_path/finder.rb
CHANGED
@@ -68,7 +68,7 @@ module ShortestPath
|
|
68
68
|
end
|
69
69
|
|
70
70
|
def found?(node)
|
71
|
-
node == destination
|
71
|
+
node == destination
|
72
72
|
end
|
73
73
|
|
74
74
|
def path_without_cache
|
@@ -84,13 +84,15 @@ module ShortestPath
|
|
84
84
|
|
85
85
|
not_found = !found?(source)
|
86
86
|
|
87
|
-
while
|
87
|
+
while pq.size != 0 && not_found
|
88
88
|
raise TimeoutError if timeout?
|
89
89
|
|
90
90
|
v = pq.pop
|
91
91
|
not_found = !found?(v)
|
92
|
+
visit v
|
92
93
|
|
93
94
|
weights = ways(v)
|
95
|
+
|
94
96
|
if weights
|
95
97
|
weights.keys.each do |w|
|
96
98
|
w_distance = shortest_distances[v] + weights[w]
|
@@ -54,11 +54,11 @@ describe ShortestPath::Finder do
|
|
54
54
|
end
|
55
55
|
|
56
56
|
it "should produce test graph" do
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
57
|
+
my_graph = graph_sample(600)
|
58
|
+
start = Time.now
|
59
|
+
result = shortest_path( "150-150", "300-300", my_graph)
|
60
|
+
#puts result.inspect
|
61
|
+
expect(Time.now-start).to be < 5
|
62
62
|
end
|
63
63
|
|
64
64
|
context "when using an edge_count filter in context " do
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shortest_path
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.5
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Alban Peignier
|
@@ -11,12 +10,11 @@ authors:
|
|
11
10
|
autorequire:
|
12
11
|
bindir: bin
|
13
12
|
cert_chain: []
|
14
|
-
date:
|
13
|
+
date: 2015-01-12 00:00:00.000000000 Z
|
15
14
|
dependencies:
|
16
15
|
- !ruby/object:Gem::Dependency
|
17
16
|
name: guard
|
18
17
|
requirement: !ruby/object:Gem::Requirement
|
19
|
-
none: false
|
20
18
|
requirements:
|
21
19
|
- - ! '>='
|
22
20
|
- !ruby/object:Gem::Version
|
@@ -24,7 +22,6 @@ dependencies:
|
|
24
22
|
type: :development
|
25
23
|
prerelease: false
|
26
24
|
version_requirements: !ruby/object:Gem::Requirement
|
27
|
-
none: false
|
28
25
|
requirements:
|
29
26
|
- - ! '>='
|
30
27
|
- !ruby/object:Gem::Version
|
@@ -32,7 +29,6 @@ dependencies:
|
|
32
29
|
- !ruby/object:Gem::Dependency
|
33
30
|
name: guard-bundler
|
34
31
|
requirement: !ruby/object:Gem::Requirement
|
35
|
-
none: false
|
36
32
|
requirements:
|
37
33
|
- - ! '>='
|
38
34
|
- !ruby/object:Gem::Version
|
@@ -40,7 +36,6 @@ dependencies:
|
|
40
36
|
type: :development
|
41
37
|
prerelease: false
|
42
38
|
version_requirements: !ruby/object:Gem::Requirement
|
43
|
-
none: false
|
44
39
|
requirements:
|
45
40
|
- - ! '>='
|
46
41
|
- !ruby/object:Gem::Version
|
@@ -48,7 +43,6 @@ dependencies:
|
|
48
43
|
- !ruby/object:Gem::Dependency
|
49
44
|
name: guard-rspec
|
50
45
|
requirement: !ruby/object:Gem::Requirement
|
51
|
-
none: false
|
52
46
|
requirements:
|
53
47
|
- - ! '>='
|
54
48
|
- !ruby/object:Gem::Version
|
@@ -56,7 +50,6 @@ dependencies:
|
|
56
50
|
type: :development
|
57
51
|
prerelease: false
|
58
52
|
version_requirements: !ruby/object:Gem::Requirement
|
59
|
-
none: false
|
60
53
|
requirements:
|
61
54
|
- - ! '>='
|
62
55
|
- !ruby/object:Gem::Version
|
@@ -64,7 +57,6 @@ dependencies:
|
|
64
57
|
- !ruby/object:Gem::Dependency
|
65
58
|
name: rake
|
66
59
|
requirement: !ruby/object:Gem::Requirement
|
67
|
-
none: false
|
68
60
|
requirements:
|
69
61
|
- - ! '>='
|
70
62
|
- !ruby/object:Gem::Version
|
@@ -72,7 +64,6 @@ dependencies:
|
|
72
64
|
type: :development
|
73
65
|
prerelease: false
|
74
66
|
version_requirements: !ruby/object:Gem::Requirement
|
75
|
-
none: false
|
76
67
|
requirements:
|
77
68
|
- - ! '>='
|
78
69
|
- !ruby/object:Gem::Version
|
@@ -80,7 +71,6 @@ dependencies:
|
|
80
71
|
- !ruby/object:Gem::Dependency
|
81
72
|
name: rspec
|
82
73
|
requirement: !ruby/object:Gem::Requirement
|
83
|
-
none: false
|
84
74
|
requirements:
|
85
75
|
- - ! '>='
|
86
76
|
- !ruby/object:Gem::Version
|
@@ -88,7 +78,6 @@ dependencies:
|
|
88
78
|
type: :development
|
89
79
|
prerelease: false
|
90
80
|
version_requirements: !ruby/object:Gem::Requirement
|
91
|
-
none: false
|
92
81
|
requirements:
|
93
82
|
- - ! '>='
|
94
83
|
- !ruby/object:Gem::Version
|
@@ -96,7 +85,6 @@ dependencies:
|
|
96
85
|
- !ruby/object:Gem::Dependency
|
97
86
|
name: priority_queue_cxx
|
98
87
|
requirement: !ruby/object:Gem::Requirement
|
99
|
-
none: false
|
100
88
|
requirements:
|
101
89
|
- - ! '>='
|
102
90
|
- !ruby/object:Gem::Version
|
@@ -104,7 +92,6 @@ dependencies:
|
|
104
92
|
type: :runtime
|
105
93
|
prerelease: false
|
106
94
|
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
none: false
|
108
95
|
requirements:
|
109
96
|
- - ! '>='
|
110
97
|
- !ruby/object:Gem::Version
|
@@ -119,6 +106,7 @@ extensions: []
|
|
119
106
|
extra_rdoc_files: []
|
120
107
|
files:
|
121
108
|
- .gitignore
|
109
|
+
- .rspec
|
122
110
|
- .rvmrc
|
123
111
|
- .travis.yml
|
124
112
|
- Gemfile
|
@@ -136,32 +124,25 @@ files:
|
|
136
124
|
- spec/spec_helper.rb
|
137
125
|
homepage: http://github.com/dryade/shortest_path
|
138
126
|
licenses: []
|
127
|
+
metadata: {}
|
139
128
|
post_install_message:
|
140
129
|
rdoc_options: []
|
141
130
|
require_paths:
|
142
131
|
- lib
|
143
132
|
required_ruby_version: !ruby/object:Gem::Requirement
|
144
|
-
none: false
|
145
133
|
requirements:
|
146
134
|
- - ! '>='
|
147
135
|
- !ruby/object:Gem::Version
|
148
136
|
version: '0'
|
149
|
-
segments:
|
150
|
-
- 0
|
151
|
-
hash: 1341351258851856295
|
152
137
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
153
|
-
none: false
|
154
138
|
requirements:
|
155
139
|
- - ! '>='
|
156
140
|
- !ruby/object:Gem::Version
|
157
141
|
version: '0'
|
158
|
-
segments:
|
159
|
-
- 0
|
160
|
-
hash: 1341351258851856295
|
161
142
|
requirements: []
|
162
143
|
rubyforge_project:
|
163
|
-
rubygems_version:
|
144
|
+
rubygems_version: 2.4.2
|
164
145
|
signing_key:
|
165
|
-
specification_version:
|
146
|
+
specification_version: 4
|
166
147
|
summary: Ruby library to find shortest path(s) in a graph
|
167
148
|
test_files: []
|