src/work/marci/merge_node_graph_wrapper_test.cc
changeset 917 ffb8f0cbcb57
parent 915 751ed145bdae
child 921 818510fa3d99
equal deleted inserted replaced
0:a90da5a4bbb1 1:88c9b8427663
     8 using std::endl;
     8 using std::endl;
     9 
     9 
    10 using namespace hugo;
    10 using namespace hugo;
    11 
    11 
    12 int main() {
    12 int main() {
    13   SmartGraph g;
    13   typedef SmartGraph Graph1;
    14   ListGraph h;
    14   typedef ListGraph Graph2;
    15   typedef MergeNodeGraphWrapper<SmartGraph, ListGraph> GW;
    15   Graph1 g;
       
    16   Graph2 h;
       
    17   typedef MergeNodeGraphWrapper<Graph1, Graph2> GW;
    16   GW gw(g, h);
    18   GW gw(g, h);
    17   g.addNode();
    19   Graph1::Node n1=g.addNode();
    18   g.addNode();
    20   Graph1::Node n2=g.addNode();
    19   g.addNode();
    21   Graph1::Node n3=g.addNode();
    20   h.addNode();
    22   Graph2::Node n4=h.addNode();
    21   h.addNode();
    23   Graph2::Node n5=h.addNode();
    22   //GW::NodeIt n(gw)
    24   //GW::NodeIt n(gw)
    23   for (GW::NodeIt n(gw); n!=INVALID; ++n) { 
    25   for (GW::NodeIt n(gw); n!=INVALID; ++n) { 
    24     cout << gw.id(n) << endl;
    26     cout << gw.id(n) << endl;
    25   }
    27   }
       
    28 
       
    29   GW::NodeMap<int> nm(gw);
       
    30   int i=0;
       
    31   for (GW::NodeIt n(gw); n!=INVALID; ++n) { 
       
    32     ++i;
       
    33     nm.set(n, i);
       
    34   }
       
    35   for (Graph1::NodeIt n(g); n!=INVALID; ++n) { 
       
    36     cout << nm[n] << endl;
       
    37   }
       
    38   for (Graph2::NodeIt n(h); n!=INVALID; ++n) { 
       
    39     cout << nm[n] << endl;
       
    40   }
    26 }
    41 }