Changeset 1008:3fef334f5f37 in lemon-0.x for src/work/marci/merge_node_graph_wrapper_test.cc
- Timestamp:
- 11/18/04 23:31:21 (20 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1398
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/work/marci/merge_node_graph_wrapper_test.cc
r1007 r1008 5 5 #include <merge_node_graph_wrapper.h> 6 6 7 #include<lemon/concept_check.h> 8 #include<lemon/concept/graph.h> 9 7 10 using std::cout; 8 11 using std::endl; 9 12 10 13 using namespace lemon; 14 using namespace lemon::concept; 11 15 12 16 class Graph3 : ListGraph { … … 19 23 typedef SmartGraph Graph1; 20 24 typedef ListGraph Graph2; 25 26 // { 27 // checkConcept<StaticGraph, NewEdgeSetGraphWrapper<Graph1, Graph2> >(); 28 // } 29 { 21 30 Graph1 g; 22 31 Graph2 h; … … 78 87 gw.print(); 79 88 } 89 } 90 { 91 Graph1 g; 92 Graph2 h; 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) { 100 Node1 n=g.addNode(); 101 e_node.set(n, INVALID); 102 } 103 for (int i=0; i<4; ++i) { 104 Graph1::Node n1=g.addNode(); 105 Graph2::Node n2=h.addNode(); 106 e_node.set(n1, n2); 107 n_node.set(n2, n1); 108 } 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); 113 // Node1 n1=n; 114 // Node1 n2=++n; 115 // Node1 n3=++n; 116 // Node1 n4=n; 117 // gw.addEdge(n1, n2); 118 // gw.addEdge(n1, n2); 119 // for (EdgeIt(e)) 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; 130 } else { 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) { 135 cout<<gw.id(e)<<" "; 136 } 137 cout<< endl; 138 } 139 } 140 } 80 141 }
Note: See TracChangeset
for help on using the changeset viewer.