COIN-OR::LEMON - Graph Library

Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/bfs_test.cc

    r228 r278  
    6363  BType::DistMap d(G);
    6464  BType::PredMap p(G);
    65   //  BType::PredNodeMap pn(G);
    6665
    6766  BType bfs_test(G);
     
    7372  n  = bfs_test.predNode(n);
    7473  d  = bfs_test.distMap();
    75 
    7674  p  = bfs_test.predMap();
    77   //  pn = bfs_test.predNodeMap();
    7875  b  = bfs_test.reached(n);
    7976
     
    8986
    9087  Digraph g;
    91   bfs(g,Node()).run();
    92   bfs(g).source(Node()).run();
     88  bool b;
     89  bfs(g).run(Node());
     90  b=bfs(g).run(Node(),Node());
     91  bfs(g).run();
    9392  bfs(g)
    94     .predMap(concepts::WriteMap<Node,Arc>())
    95     .distMap(concepts::WriteMap<Node,VType>())
     93    .predMap(concepts::ReadWriteMap<Node,Arc>())
     94    .distMap(concepts::ReadWriteMap<Node,VType>())
    9695    .reachedMap(concepts::ReadWriteMap<Node,bool>())
    9796    .processedMap(concepts::WriteMap<Node,bool>())
    9897    .run(Node());
     98  b=bfs(g)
     99    .predMap(concepts::ReadWriteMap<Node,Arc>())
     100    .distMap(concepts::ReadWriteMap<Node,VType>())
     101    .reachedMap(concepts::ReadWriteMap<Node,bool>())
     102    .processedMap(concepts::WriteMap<Node,bool>())
     103    .path(concepts::Path<Digraph>())
     104    .dist(VType())
     105    .run(Node(),Node());
     106  bfs(g)
     107    .predMap(concepts::ReadWriteMap<Node,Arc>())
     108    .distMap(concepts::ReadWriteMap<Node,VType>())
     109    .reachedMap(concepts::ReadWriteMap<Node,bool>())
     110    .processedMap(concepts::WriteMap<Node,bool>())
     111    .run();
    99112}
    100113
     
    115128  bfs_test.run(s);
    116129
    117   check(bfs_test.dist(t)==2,"Bfs found a wrong path." << bfs_test.dist(t));
     130  check(bfs_test.dist(t)==2,"Bfs found a wrong path.");
    118131
    119132  Path<Digraph> p = bfs_test.path(t);
     
    129142    check( !bfs_test.reached(u) ||
    130143           (bfs_test.dist(v) <= bfs_test.dist(u)+1),
    131            "Wrong output." << G.id(v) << ' ' << G.id(u));
     144           "Wrong output. " << G.id(u) << "->" << G.id(v));
    132145  }
    133146
     
    141154        check(bfs_test.dist(v) - bfs_test.dist(u) == 1,
    142155              "Wrong distance. Difference: "
    143               << std::abs(bfs_test.dist(v) - bfs_test.dist(u)
    144                           - 1));
     156              << std::abs(bfs_test.dist(v) - bfs_test.dist(u) - 1));
    145157      }
    146158    }
     159  }
     160
     161  {
     162    NullMap<Node,Arc> myPredMap;
     163    bfs(G).predMap(myPredMap).run(s);
    147164  }
    148165}
Note: See TracChangeset for help on using the changeset viewer.