@@ -92,11 +92,11 @@ function runSearch(graph, start, end, options) {
92
92
if ( ! ( graph instanceof Graph ) ) {
93
93
graph = new Graph ( graph ) ;
94
94
}
95
- var start = graph . grid [ start [ 0 ] ] [ start [ 1 ] ] ;
96
- var end = graph . grid [ end [ 0 ] ] [ end [ 1 ] ] ;
97
- var sTime = new Date ( ) ;
98
- var result = astar . search ( graph , start , end , options ) ;
99
- var eTime = new Date ( ) ;
95
+ start = graph . grid [ start [ 0 ] ] [ start [ 1 ] ] ;
96
+ end = graph . grid [ end [ 0 ] ] [ end [ 1 ] ] ;
97
+ var sTime = new Date ( ) ,
98
+ result = astar . search ( graph , start , end , options ) ,
99
+ eTime = new Date ( ) ;
100
100
return {
101
101
result : result ,
102
102
text : pathToString ( result ) ,
@@ -132,7 +132,9 @@ test( "GPS Pathfinding", function() {
132
132
133
133
function CityGraph ( data , links ) {
134
134
this . nodes = [ ] ;
135
- var cities = this . cities = { } ;
135
+ this . links = links ;
136
+ this . cities = { } ;
137
+
136
138
for ( var i = 0 ; i < data . length ; ++ i ) {
137
139
var city = data [ i ] ,
138
140
obj = new CityNode ( city . name , city . lat , city . lng ) ;
@@ -141,11 +143,8 @@ test( "GPS Pathfinding", function() {
141
143
this . nodes . push ( obj ) ;
142
144
}
143
145
144
- cities [ obj . name ] = obj ;
146
+ this . cities [ obj . name ] = obj ;
145
147
}
146
-
147
- this . cities = cities ;
148
- this . links = links ;
149
148
}
150
149
151
150
CityGraph . prototype . neighbors = function ( node ) {
0 commit comments