File tree 1 file changed +7
-4
lines changed
1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -191,9 +191,11 @@ export default function Graph({ params }: { params: { lang: Locale } }) {
191
191
pq . length == 0 ||
192
192
start === undefined ||
193
193
end === undefined ||
194
- completeness
195
- )
194
+ ( algo === 0 && completeness )
195
+ ) {
196
+ set_front ( end ) ;
196
197
return ;
198
+ }
197
199
const pqcopy = [ ...pq ] ;
198
200
199
201
const node_first = pqcopy . shift ( ) . node ;
@@ -202,8 +204,9 @@ export default function Graph({ params }: { params: { lang: Locale } }) {
202
204
203
205
visited . set ( firstkey , true ) ;
204
206
set_total_visited ( total_visited + 1 ) ;
205
- if ( node_first . x === end . x && node_first . y === end . y ) {
207
+ if ( node_first . x === end . x && node_first . y === end . y && algo === 0 ) {
206
208
set_pq ( [ ] ) ;
209
+ set_front ( end ) ;
207
210
return ;
208
211
}
209
212
// get adjs
@@ -258,7 +261,7 @@ export default function Graph({ params }: { params: { lang: Locale } }) {
258
261
pq_calc ( right_adj ) ;
259
262
pqcopy . sort ( ( a , b ) => a . priority - b . priority ) ;
260
263
set_pq ( pqcopy ) ;
261
- } , 10 ) ;
264
+ } , 5 ) ;
262
265
return ( ) => {
263
266
clearTimeout ( conn ) ;
264
267
} ;
You can’t perform that action at this time.
0 commit comments