@@ -107,6 +107,7 @@ function drawSnapshot(s, round) {
107107 $ ( '#snapshotList' + round + ' a' ) . removeClass ( 'active' ) ;
108108 $ ( '#snapshotButton' + round + '-' + s ) . addClass ( 'active' ) ;
109109
110+ console . log ( snapshots [ s ] ) ;
110111 drawFullGraph ( s ) ;
111112 drawPSGraph ( s ) ;
112113} ;
@@ -249,8 +250,6 @@ function initializeGraphs() {
249250 } ) ;
250251} ;
251252
252-
253-
254253function drawFullGraph ( s ) {
255254
256255 fsnodes = [ ] ; // The actual nodes of the graph
@@ -263,29 +262,33 @@ function drawFullGraph(s) {
263262 newfspaths = { } ; // The links that were newly added in this snapshot
264263 var fs2ps = { } ; // Mapping from the full state graph to the partial state graph
265264
265+ //Checks if nodes are new nodes
266266 if ( ( s - 1 in snapshots ) && ( snapshots [ s ] . solution . round == snapshots [ s - 1 ] . solution . round ) )
267- for ( n in snapshots [ s ] . solution . prpsearchnodes )
268- if ( ! ( n in snapshots [ s - 1 ] . solution . prpsearchnodes ) )
267+ for ( n in snapshots [ s ] . solution . pr2searchnodes )
268+ if ( ! ( n in snapshots [ s - 1 ] . solution . pr2searchnodes ) )
269269 newfsnodes [ n ] = true ;
270270
271+ //Maps partial states and full states
271272 for ( var psid in snapshots [ s ] . solution . ps2fs )
272273 for ( var fsid in snapshots [ s ] . solution . ps2fs [ psid ] )
273274 fs2ps [ fsid ] = psid ;
274275
276+ //initialize nodes
275277 var i = 0 ;
276- for ( var nid in snapshots [ s ] . solution . prpsearchnodes ) {
277- n = snapshots [ s ] . solution . prpsearchnodes [ nid ] ; // not doing anything with this for now
278+ for ( var nid in snapshots [ s ] . solution . pr2searchnodes ) {
279+ n = snapshots [ s ] . solution . pr2searchnodes [ nid ] ; // not doing anything with this for now
278280 fsnodes . push ( { origname : n . name , name : n . name , id : i , weight : 1 , nid : nid , psid : fs2ps [ nid ] ,
279281 open :n . open , subsumed :n . subsumed , poisoned :n . poisoned } ) ;
280282 fsnode2id [ nid ] = i ;
281283 fssucc [ i ] = [ ] ;
282284 fspred [ i ] = [ ] ;
283285 i ++ ;
284286 }
287+
288+ //find successors and previous nodes
289+ for ( i = 0 ; i < snapshots [ s ] . solution . pr2searchnodelinks . length ; ++ i ) {
285290
286- for ( i = 0 ; i < snapshots [ s ] . solution . prpsearchnodelinks . length ; ++ i ) {
287-
288- e = snapshots [ s ] . solution . prpsearchnodelinks [ i ] ;
291+ e = snapshots [ s ] . solution . pr2searchnodelinks [ i ] ;
289292 var u = fsnode2id [ e [ 0 ] ] ;
290293 var v = fsnode2id [ e [ 1 ] ] ;
291294
@@ -297,12 +300,12 @@ function drawFullGraph(s) {
297300
298301 if ( ( s - 1 in snapshots ) && ( snapshots [ s ] . solution . round == snapshots [ s - 1 ] . solution . round ) ) {
299302 var oldpaths = { } ;
300- for ( i = 0 ; i < snapshots [ s - 1 ] . solution . prpsearchnodelinks . length ; ++ i ) {
301- e = snapshots [ s - 1 ] . solution . prpsearchnodelinks [ i ] ;
303+ for ( i = 0 ; i < snapshots [ s - 1 ] . solution . pr2searchnodelinks . length ; ++ i ) {
304+ e = snapshots [ s - 1 ] . solution . pr2searchnodelinks [ i ] ;
302305 oldpaths [ fsnode2id [ e [ 0 ] ] + "-" + fsnode2id [ e [ 1 ] ] ] = true ;
303306 }
304- for ( i = 0 ; i < snapshots [ s ] . solution . prpsearchnodelinks . length ; ++ i ) {
305- e = snapshots [ s ] . solution . prpsearchnodelinks [ i ] ;
307+ for ( i = 0 ; i < snapshots [ s ] . solution . pr2searchnodelinks . length ; ++ i ) {
308+ e = snapshots [ s ] . solution . pr2searchnodelinks [ i ] ;
306309 if ( ! ( fsnode2id [ e [ 0 ] ] + "-" + fsnode2id [ e [ 1 ] ] in oldpaths ) )
307310 newfspaths [ fsnode2id [ e [ 0 ] ] + "-" + fsnode2id [ e [ 1 ] ] ] = true ;
308311 }
@@ -477,27 +480,30 @@ function drawPSGraph(s) {
477480 var ncount = 0 ;
478481 for ( var nid in snapshots [ s ] . solution . psgraph . nodes ) {
479482 n = snapshots [ s ] . solution . psgraph . nodes [ nid ] ;
483+ nid = String ( parseInt ( nid ) - 1 ) ;
480484 nname = n . action + ' (' + n . distance + ')' ;
481485 init = false ;
482486 if ( n . distance == 0 )
483487 nname = 'Goal' ;
484488 if ( nid == snapshots [ s ] . solution . psgraph . init )
485489 init = true ;
486490 psnodes . push ( { id : ncount , origname : nname , name : nname , data : n , init : init , weight : n . distance , nid : nid , sink :false } ) ;
487- psnode2id [ '' + nid ] = ncount ;
491+ psnode2id [ '' + nid ] = ncount ;
488492 pssucc [ ncount ] = [ ] ;
489493 pspred [ ncount ] = [ ] ;
490494 ncount ++ ;
491495 }
492496
493497 for ( var i = 0 ; i < snapshots [ s ] . solution . psgraph . edges . length ; ++ i ) {
494498 e = snapshots [ s ] . solution . psgraph . edges [ i ] ;
499+ console . log ( e ) ;
495500
496501 if ( ">" === e [ 1 ] ) {
497502
498503 var u , v ;
499504
500505 if ( - 1 == e [ 2 ] ) {
506+ console . log ( "path 1" ) ;
501507 var nid = "undefined" + ncount ;
502508 psnodes . push ( { id :ncount , origname : "undefined" , name : "undefined" , weight : 0 , nid : nid , sink :true } ) ;
503509 psnode2id [ nid ] = ncount ;
@@ -507,15 +513,28 @@ function drawPSGraph(s) {
507513 v = ncount ;
508514 ncount ++ ;
509515 } else {
516+ console . log ( "path 2" ) ;
510517 u = psnode2id [ e [ 0 ] ] ;
511518 v = psnode2id [ e [ 2 ] ] ;
512519 }
513520
514- pslinks . push ( { source :u , target :v , id : u + '-' + v } ) ;
515-
516- pssucc [ u ] . push ( v ) ;
517- pspred [ v ] . push ( u ) ;
518-
521+ console . log ( u ) ;
522+ console . log ( v ) ;
523+
524+ console . log ( psnodes ) ;
525+ console . log ( pslinks ) ;
526+ console . log ( pssucc ) ;
527+ console . log ( pspred ) ;
528+ console . log ( psstates ) ;
529+ console . log ( newpsnodes ) ;
530+ console . log ( newpspaths ) ;
531+ console . log ( psnode2id ) ;
532+
533+ if ( ! ( u === undefined || v === undefined ) ) {
534+ pslinks . push ( { source : u , target : v , id : u + '-' + v } ) ;
535+ pssucc [ u ] . push ( v ) ;
536+ pspred [ v ] . push ( u ) ;
537+ }
519538 }
520539 }
521540
@@ -539,7 +558,7 @@ function drawPSGraph(s) {
539558 function gen_path ( id ) {
540559 // Base case is when this node isn't a 1-in / 1-out
541560 if ( ( 1 != pssucc [ id ] . length ) || ( ( 1 != pspred [ id ] . length ) ) ) {
542- return [ id , '' ] ;
561+ // return [id, ''];
543562 // Only use this label if it is the initial search node
544563 if ( 0 == pspred [ id ] . length )
545564 return [ id , '\n' + psnodes [ id ] . origname ] ;
0 commit comments