Changeset 564:f84611a14a33 in lemon-0.x
- Timestamp:
- 05/07/04 07:29:45 (21 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@739
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/test/graph_test.cc
r550 r564 1 1 #include<iostream> 2 2 #include<hugo/smart_graph.h> 3 //#include<hugo/skeletons/graph.h>3 #include<hugo/skeletons/graph.h> 4 4 //#include<../work/alpar/list_graph.h> 5 5 … … 173 173 } 174 174 175 176 177 template<class Graph> void addPetersen(Graph &G) 175 template<class Graph> struct PetNodes 178 176 { 179 177 std::vector<typename Graph::Node> outer, inner; 180 181 for(int i=0;i<5;i++) { 182 outer.push_back(G.addNode()); 183 inner.push_back(G.addNode()); 184 } 185 186 for(int i=0;i<5;i++) { 187 G.addEdge(outer[i],inner[i]); 188 G.addEdge(outer[i],outer[(i+1)%5]); 189 G.addEdge(inner[i],inner[(i+2)%5]); 190 } 178 std::vector<typename Graph::Edge> outcir, incir, cons; 179 }; 180 181 template<class Graph> PetNodes<Graph> addPetersen(Graph &G,int num=5) 182 { 183 //std::vector<typename Graph::Node> outer, inner; 184 185 PetNodes<Graph> n; 186 187 for(int i=0;i<num;i++) { 188 n.outer.push_back(G.addNode()); 189 n.inner.push_back(G.addNode()); 190 } 191 192 for(int i=0;i<num;i++) { 193 n.cons.push_back(G.addEdge(n.outer[i],n.inner[i])); 194 n.outcir.push_back(G.addEdge(n.outer[i],n.outer[(i+1)%5])); 195 n.incir.push_back(G.addEdge(n.inner[i],n.inner[(i+2)%5])); 196 } 197 return n; 191 198 } 192 199 … … 270 277 } 271 278 272 //template void checkCompile<GraphSkeleton>(GraphSkeleton &);279 template void checkCompile<GraphSkeleton>(GraphSkeleton &); 273 280 template void checkCompile<SmartGraph>(SmartGraph &); 274 281 template void checkCompile<SymSmartGraph>(SymSmartGraph &); … … 287 294 checkPetersen(G); 288 295 } 289 {290 ListGraph G;291 addPetersen(G);292 bidirPetersen(G);293 checkPetersen(G);294 }296 // { 297 // ListGraph G; 298 // addPetersen(G); 299 // bidirPetersen(G); 300 // checkPetersen(G); 301 // } 295 302 { 296 303 SymSmartGraph G; … … 298 305 checkPetersen(G); 299 306 } 300 {301 SymListGraph G;302 addPetersen(G);303 checkPetersen(G);304 }307 // { 308 // SymListGraph G; 309 // addPetersen(G); 310 // checkPetersen(G); 311 // } 305 312 306 313 //\todo map tests.
Note: See TracChangeset
for help on using the changeset viewer.