dijkstra 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/dijkstra.rb +1 -22
- metadata +1 -1
data/lib/dijkstra.rb
CHANGED
@@ -139,25 +139,4 @@ class Dijkstra
|
|
139
139
|
|
140
140
|
f.close()
|
141
141
|
end
|
142
|
-
end
|
143
|
-
|
144
|
-
r = [[5],
|
145
|
-
[1,2,1],
|
146
|
-
[1,3,9],
|
147
|
-
[1,5,3],
|
148
|
-
[2,4,3],
|
149
|
-
[2,3,7],
|
150
|
-
[4,3,2],
|
151
|
-
[4,1,1],
|
152
|
-
[5,2,4],
|
153
|
-
[5,4,2]]
|
154
|
-
|
155
|
-
start_point = 1
|
156
|
-
end_point = 3
|
157
|
-
|
158
|
-
ob = Dijkstra.new(start_point, end_point, r)
|
159
|
-
|
160
|
-
print "Cost = ", ob.getCost(), "\n"
|
161
|
-
print "Shortest Path = ", ob.getShortestPath()
|
162
|
-
|
163
|
-
ob.writeToFile("shortestpath.out")
|
142
|
+
end
|