COIN-OR::LEMON - Graph Library

source: lemon-0.x/src/work/marci/merge_node_graph_wrapper_test.cc @ 965:1e16b8dac159

Last change on this file since 965:1e16b8dac159 was 921:818510fa3d99, checked in by Alpar Juttner, 20 years ago

hugo -> lemon

File size: 871 bytes
Line 
1#include <iostream>
2
3#include <lemon/list_graph.h>
4#include <lemon/smart_graph.h>
5#include <merge_node_graph_wrapper.h>
6
7using std::cout;
8using std::endl;
9
10using namespace lemon;
11
12int main() {
13  typedef SmartGraph Graph1;
14  typedef ListGraph Graph2;
15  Graph1 g;
16  Graph2 h;
17  typedef MergeNodeGraphWrapper<Graph1, Graph2> GW;
18  GW gw(g, h);
19  Graph1::Node n1=g.addNode();
20  Graph1::Node n2=g.addNode();
21  Graph1::Node n3=g.addNode();
22  Graph2::Node n4=h.addNode();
23  Graph2::Node n5=h.addNode();
24  //GW::NodeIt n(gw)
25  for (GW::NodeIt n(gw); n!=INVALID; ++n) {
26    cout << gw.id(n) << endl;
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  }
41}
Note: See TracBrowser for help on using the repository browser.