3 #include <lemon/list_graph.h>
4 #include <lemon/smart_graph.h>
5 #include <merge_node_graph_wrapper.h>
7 #include<lemon/concept_check.h>
8 #include<lemon/concept/graph.h>
13 using namespace lemon;
14 using namespace lemon::concept;
16 class Graph3 : ListGraph {
18 class Node : public ListGraph::Node { };
23 typedef SmartGraph Graph1;
24 typedef ListGraph Graph2;
27 // checkConcept<StaticGraph, NewEdgeSetGraphWrapper<Graph1, Graph2> >();
32 typedef MergeNodeGraphWrapper<Graph1, Graph2> GW;
34 Graph1::Node n1=g.addNode();
35 Graph1::Node n2=g.addNode();
36 Graph1::Node n3=g.addNode();
37 Graph2::Node n4=h.addNode();
38 Graph2::Node n5=h.addNode();
40 for (GW::NodeIt n(gw); n!=INVALID; ++n) {
41 cout << gw.id(n) << endl;
44 GW::NodeMap<int> nm(gw);
46 for (GW::NodeIt n(gw); n!=INVALID; ++n) {
50 for (Graph1::NodeIt n(g); n!=INVALID; ++n) {
51 cout << nm[n] << endl;
53 for (Graph2::NodeIt n(h); n!=INVALID; ++n) {
54 cout << nm[n] << endl;
60 // typedef SmartGraph Graph1;
61 typedef ListGraph Graph1;
62 typedef ListGraph Graph2;
65 typedef MergeNodeGraphWrapper<Graph1, Graph2> GW;
70 // typedef SmartGraph Graph1;
71 typedef Graph3 Graph1;
72 typedef ListGraph Graph2;
75 typedef MergeNodeGraphWrapper<Graph1, Graph2> GW;
80 // typedef SmartGraph Graph1;
81 typedef ListGraph Graph1;
82 typedef Graph3 Graph2;
85 typedef MergeNodeGraphWrapper<Graph1, Graph2> GW;
93 typedef Graph1::Node Node1;
94 typedef Graph2::Node Node2;
95 typedef NewEdgeSetGraphWrapper<Graph1, Graph2> GW;
96 Graph1::NodeMap<Graph2::Node> e_node(g);
97 Graph2::NodeMap<Graph1::Node> n_node(h);
98 GW gw(g, h, e_node, n_node);
99 for (int i=0; i<4; ++i) {
101 e_node.set(n, INVALID);
103 for (int i=0; i<4; ++i) {
104 Graph1::Node n1=g.addNode();
105 Graph2::Node n2=h.addNode();
109 for (Graph2::NodeIt n(h); n!=INVALID; ++n)
110 for (Graph2::NodeIt m(h); m!=INVALID; ++m)
111 if ((h.id(n)+h.id(m))%3==0) h.addEdge(n, m);
112 // Graph1::NodeIt n(g);
117 // gw.addEdge(n1, n2);
118 // gw.addEdge(n1, n2);
120 // Graph1::Node n1=g.addNode();
121 // Graph1::Node n2=g.addNode();
122 // Graph1::Node n3=g.addNode();
123 // Graph2::Node n4=h.addNode();
124 // Graph2::Node n5=h.addNode();
125 for (GW::EdgeIt e(gw); e!=INVALID; ++e)
126 cout << gw.id(e) << endl;
127 for (GW::NodeIt n(gw); n!=INVALID; ++n) {
128 if (e_node[n]==INVALID) {
129 cout<<gw.id(n)<<" INVALID"<<endl;
131 cout <<gw.id(n)<<" "<<h.id(e_node[n])<<" out_edges: ";
132 // cout << &e_node << endl;
133 //cout << &n_node << endl;
134 for (GW::OutEdgeIt e(gw, n); e!=INVALID; ++e) {