COIN-OR::LEMON - Graph Library

Ignore:
Timestamp:
04/07/04 12:57:58 (20 years ago)
Author:
marci
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@430
Message:

gw

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/work/marci/iterator_bfs_demo.cc

    r304 r312  
    8989
    9090  {
    91     typedef TrivGraphWrapper<const Graph> GW;
    92     GW gw(G);
    93 
    94     EdgeNameMap< GW, Graph::NodeMap<string> > edge_name(gw, node_name);
     91    EdgeNameMap< Graph, Graph::NodeMap<string> > edge_name(G, node_name);
    9592   
    9693    cout << "bfs and dfs iterator demo on the directed graph" << endl;
    97     for(GW::NodeIt n(gw); gw.valid(n); gw.next(n)) {
     94    for(Graph::NodeIt n(G); G.valid(n); G.next(n)) {
    9895      cout << node_name[n] << ": ";
    9996      cout << "out edges: ";
    100       for(GW::OutEdgeIt e(gw, n); gw.valid(e); gw.next(e))
     97      for(Graph::OutEdgeIt e(G, n); G.valid(e); G.next(e))
    10198        cout << edge_name[e] << " ";
    10299      cout << "in edges: ";
    103       for(GW::InEdgeIt e(gw, n); gw.valid(e); gw.next(e))
     100      for(Graph::InEdgeIt e(G, n); G.valid(e); G.next(e))
    104101        cout << edge_name[e] << " ";
    105102      cout << endl;
     
    107104
    108105    cout << "bfs from s ..." << endl;
    109     BfsIterator5< GW, GW::NodeMap<bool> > bfs(gw);
     106    BfsIterator5< Graph, Graph::NodeMap<bool> > bfs(G);
    110107    bfs.pushAndSetReached(s);
    111108    while (!bfs.finished()) {
    112109      //cout << "edge: ";
    113       if (gw.valid(bfs)) {
     110      if (G.valid(bfs)) {
    114111        cout << edge_name[bfs] << /*endl*/", " <<
    115           node_name[gw.aNode(bfs)] <<
    116           (bfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") <<
    117           node_name[gw.bNode(bfs)] <<
     112          node_name[G.aNode(bfs)] <<
     113          (bfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") <<
     114          node_name[G.bNode(bfs)] <<
    118115          (bfs.isBNodeNewlyReached() ? ": is newly reached." :
    119116           ": is not newly reached.");
     
    140137
    141138    cout << "dfs from s ..." << endl;
    142     DfsIterator5< GW, GW::NodeMap<bool> > dfs(gw);
     139    DfsIterator5< Graph, Graph::NodeMap<bool> > dfs(G);
    143140    dfs.pushAndSetReached(s);
    144141    while (!dfs.finished()) {
    145142      ++dfs;
    146143      //cout << "edge: ";
    147       if (gw.valid(dfs)) {
     144      if (G.valid(dfs)) {
    148145        cout << edge_name[dfs] << /*endl*/", " <<
    149           node_name[gw.aNode(dfs)] <<
    150           (dfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") <<
    151           node_name[gw.bNode(dfs)] <<
     146          node_name[G.aNode(dfs)] <<
     147          (dfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") <<
     148          node_name[G.bNode(dfs)] <<
    152149          (dfs.isBNodeNewlyReached() ? ": is newly reached." :
    153150           ": is not newly reached.");
     
    165162
    166163  {
    167     typedef RevGraphWrapper<const TrivGraphWrapper<const Graph> > GW;
     164    typedef RevGraphWrapper<const Graph> GW;
    168165    GW gw(G);
    169166   
     
    241238  {
    242239    //typedef UndirGraphWrapper<const Graph> GW;
    243     typedef UndirGraphWrapper<const TrivGraphWrapper<const Graph> > GW;
     240    typedef UndirGraphWrapper<const Graph> GW;
    244241    GW gw(G);
    245242   
Note: See TracChangeset for help on using the changeset viewer.