@@ -92,11 +92,11 @@ function runSearch(graph, start, end, options) {
9292 if ( ! ( graph instanceof Graph ) ) {
9393 graph = new Graph ( graph ) ;
9494 }
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 ( ) ;
100100 return {
101101 result : result ,
102102 text : pathToString ( result ) ,
@@ -132,7 +132,9 @@ test( "GPS Pathfinding", function() {
132132
133133 function CityGraph ( data , links ) {
134134 this . nodes = [ ] ;
135- var cities = this . cities = { } ;
135+ this . links = links ;
136+ this . cities = { } ;
137+
136138 for ( var i = 0 ; i < data . length ; ++ i ) {
137139 var city = data [ i ] ,
138140 obj = new CityNode ( city . name , city . lat , city . lng ) ;
@@ -141,11 +143,8 @@ test( "GPS Pathfinding", function() {
141143 this . nodes . push ( obj ) ;
142144 }
143145
144- cities [ obj . name ] = obj ;
146+ this . cities [ obj . name ] = obj ;
145147 }
146-
147- this . cities = cities ;
148- this . links = links ;
149148 }
150149
151150 CityGraph . prototype . neighbors = function ( node ) {
0 commit comments