test/dfs_test.cc
changeset 2351 8e3a00d4678e
parent 2260 4274224f8a7d
child 2391 14a343be7a5a
equal deleted inserted replaced
7:87de77151745 8:3e5e0bf51ef5
    57   d  = dfs_test.distMap();
    57   d  = dfs_test.distMap();
    58   p  = dfs_test.predMap();
    58   p  = dfs_test.predMap();
    59   //  pn = dfs_test.predNodeMap();
    59   //  pn = dfs_test.predNodeMap();
    60   b  = dfs_test.reached(n);
    60   b  = dfs_test.reached(n);
    61 
    61 
    62   Path<Graph> pp(G);
    62   Path<Graph> pp = dfs_test.path(n);
    63   dfs_test.getPath(pp,n);
       
    64 }
    63 }
    65 
    64 
    66 
    65 
    67 void check_Dfs_Function_Compile() 
    66 void check_Dfs_Function_Compile() 
    68 {
    67 {
   106   t=ps.inner[0];
   105   t=ps.inner[0];
   107   
   106   
   108   Dfs<Graph> dfs_test(G);
   107   Dfs<Graph> dfs_test(G);
   109   dfs_test.run(s);  
   108   dfs_test.run(s);  
   110   
   109   
   111   Path<Graph> p(G);
   110   Path<Graph> p = dfs_test.path(t);
   112   check(dfs_test.getPath(p,t),"getPath() failed to set the path.");
   111   check(p.length()==dfs_test.dist(t),"path() found a wrong path.");
   113   check(p.length()==dfs_test.dist(t),"getPath() found a wrong path.");
   112   check(checkPath(G, p),"path() found a wrong path.");
       
   113   check(pathSource(G, p) == s,"path() found a wrong path.");
       
   114   check(pathTarget(G, p) == t,"path() found a wrong path.");
   114   
   115   
   115   for(NodeIt v(G); v!=INVALID; ++v) {
   116   for(NodeIt v(G); v!=INVALID; ++v) {
   116     check(dfs_test.reached(v),"Each node should be reached.");
   117     check(dfs_test.reached(v),"Each node should be reached.");
   117     if ( dfs_test.predEdge(v)!=INVALID ) {
   118     if ( dfs_test.predEdge(v)!=INVALID ) {
   118       Edge e=dfs_test.predEdge(v);
   119       Edge e=dfs_test.predEdge(v);