11function DFS ( node , parent , weight ) { // node = current node, parent = previous node
22 if ( minWeight < weight ) return ;
33 if ( node == e ) {
4- tracer . _next ( ) . _visit ( node , parent , weight ) ;
5- tracer . _next ( ) . _leave ( node , parent , 0 ) ;
4+ tracer . _visit ( node , parent , weight ) . _wait ( ) ;
5+ tracer . _leave ( node , parent , 0 ) . _wait ( ) ;
66 if ( minWeight > weight ) {
77 minWeight = weight ;
88 }
99 return ;
1010 }
1111 D [ node ] = true ; // label current node as discovered
12- tracer . _next ( ) . _visit ( node , parent , weight ) ;
12+ tracer . _visit ( node , parent , weight ) . _wait ( ) ;
1313 for ( var i = 0 ; i < G [ node ] . length ; i ++ ) {
1414 if ( G [ node ] [ i ] ) { // if the path from current node to the i-th node exists
1515 if ( ! D [ i ] ) { // if the i-th node is not labeled as discovered
@@ -18,7 +18,7 @@ function DFS(node, parent, weight) { // node = current node, parent = previous n
1818 }
1919 }
2020 D [ node ] = false ; // label current node as undiscovered
21- tracer . _next ( ) . _leave ( node , parent , 0 ) ;
21+ tracer . _leave ( node , parent , 0 ) . _wait ( ) ;
2222}
2323var s = Math . random ( ) * G . length | 0 ; // s = start node
2424var e ; // e = end node
0 commit comments