src/work/marci/merge_node_graph_wrapper_test.cc
author marci
Tue, 28 Sep 2004 17:00:18 +0000
changeset 917 ffb8f0cbcb57
parent 915 751ed145bdae
child 921 818510fa3d99
permissions -rw-r--r--
merge_node_graph_wrapper::nodemap
marci@915
     1
#include <iostream>
marci@915
     2
marci@915
     3
#include <hugo/list_graph.h>
marci@915
     4
#include <hugo/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
marci@915
    10
using namespace hugo;
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
}