src/work/marci/merge_node_graph_wrapper_test.cc
author marci
Sat, 16 Oct 2004 00:20:13 +0000
changeset 944 4f064aff855e
parent 917 ffb8f0cbcb57
child 1007 a7d5fe18d8f9
permissions -rw-r--r--
It's time to design an iterable generic bfs
marci@915
     1
#include <iostream>
marci@915
     2
alpar@921
     3
#include <lemon/list_graph.h>
alpar@921
     4
#include <lemon/smart_graph.h>
marci@915
     5
#include <merge_node_graph_wrapper.h>
marci@915
     6
marci@915
     7
using std::cout;
marci@915
     8
using std::endl;
marci@915
     9
alpar@921
    10
using namespace lemon;
marci@915
    11
marci@915
    12
int main() {
marci@917
    13
  typedef SmartGraph Graph1;
marci@917
    14
  typedef ListGraph Graph2;
marci@917
    15
  Graph1 g;
marci@917
    16
  Graph2 h;
marci@917
    17
  typedef MergeNodeGraphWrapper<Graph1, Graph2> GW;
marci@915
    18
  GW gw(g, h);
marci@917
    19
  Graph1::Node n1=g.addNode();
marci@917
    20
  Graph1::Node n2=g.addNode();
marci@917
    21
  Graph1::Node n3=g.addNode();
marci@917
    22
  Graph2::Node n4=h.addNode();
marci@917
    23
  Graph2::Node n5=h.addNode();
marci@915
    24
  //GW::NodeIt n(gw)
marci@915
    25
  for (GW::NodeIt n(gw); n!=INVALID; ++n) { 
marci@915
    26
    cout << gw.id(n) << endl;
marci@915
    27
  }
marci@917
    28
marci@917
    29
  GW::NodeMap<int> nm(gw);
marci@917
    30
  int i=0;
marci@917
    31
  for (GW::NodeIt n(gw); n!=INVALID; ++n) { 
marci@917
    32
    ++i;
marci@917
    33
    nm.set(n, i);
marci@917
    34
  }
marci@917
    35
  for (Graph1::NodeIt n(g); n!=INVALID; ++n) { 
marci@917
    36
    cout << nm[n] << endl;
marci@917
    37
  }
marci@917
    38
  for (Graph2::NodeIt n(h); n!=INVALID; ++n) { 
marci@917
    39
    cout << nm[n] << endl;
marci@917
    40
  }
marci@915
    41
}