COIN-OR::LEMON - Graph Library

Changeset 564:f84611a14a33 in lemon-0.x for src/test


Ignore:
Timestamp:
05/07/04 07:29:45 (20 years ago)
Author:
Alpar Juttner
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@739
Message:

skeleton tests turned on again.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/test/graph_test.cc

    r550 r564  
    11#include<iostream>
    22#include<hugo/smart_graph.h>
    3 //#include<hugo/skeletons/graph.h>
     3#include<hugo/skeletons/graph.h>
    44//#include<../work/alpar/list_graph.h>
    55
     
    173173}
    174174
    175 
    176 
    177 template<class Graph> void addPetersen(Graph &G)
     175template<class Graph> struct PetNodes
    178176{
    179177  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
     181template<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;
    191198}
    192199
     
    270277}
    271278
    272 //template void checkCompile<GraphSkeleton>(GraphSkeleton &);
     279template void checkCompile<GraphSkeleton>(GraphSkeleton &);
    273280template void checkCompile<SmartGraph>(SmartGraph &);
    274281template void checkCompile<SymSmartGraph>(SymSmartGraph &);
     
    287294    checkPetersen(G);
    288295  }
    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//   }
    295302  {
    296303    SymSmartGraph G;
     
    298305    checkPetersen(G);
    299306  }
    300   {
    301     SymListGraph G;
    302     addPetersen(G);
    303     checkPetersen(G);
    304   }
     307//   {
     308//     SymListGraph G;
     309//     addPetersen(G);
     310//     checkPetersen(G);
     311//   }
    305312
    306313  //\todo map tests.
Note: See TracChangeset for help on using the changeset viewer.