src/test/test_tools.h
changeset 937 d4e911acef3d
parent 921 818510fa3d99
child 946 c94ef40a22ce
     1.1 --- a/src/test/test_tools.h	Mon Oct 04 16:03:25 2004 +0000
     1.2 +++ b/src/test/test_tools.h	Mon Oct 04 17:13:21 2004 +0000
     1.3 @@ -67,7 +67,7 @@
     1.4  ///Adds a Petersen graph to \c G.
     1.5  
     1.6  ///Adds a Petersen graph to \c G.
     1.7 -///\return The nodes end edges og the generated graph.
     1.8 +///\return The nodes and edges of the generated graph.
     1.9  
    1.10  template<typename Graph>
    1.11  PetStruct<Graph> addPetersen(Graph &G,int num=5)
    1.12 @@ -87,6 +87,45 @@
    1.13   return n;
    1.14  }
    1.15  
    1.16 +///Structure returned by \ref addSymPetersen().
    1.17  
    1.18 +///Structure returned by \ref addSymPetersen().
    1.19 +///
    1.20 +template<class Graph> struct SymPetStruct
    1.21 +{
    1.22 +  ///Vector containing the outer nodes.
    1.23 +  std::vector<typename Graph::Node> outer;
    1.24 +  ///Vector containing the inner nodes.
    1.25 +  std::vector<typename Graph::Node> inner;
    1.26 +  ///Vector containing the edges of the inner circle.
    1.27 +  std::vector<typename Graph::SymEdge> incir;
    1.28 +  ///Vector containing the edges of the outer circle.
    1.29 +  std::vector<typename Graph::SymEdge> outcir;
    1.30 +  ///Vector containing the chord edges.
    1.31 +  std::vector<typename Graph::SymEdge> chords;
    1.32 +};
    1.33 +
    1.34 +///Adds a Petersen graph to the symmetric \c G.
    1.35 +
    1.36 +///Adds a Petersen graph to the symmetric \c G.
    1.37 +///\return The nodes and edges of the generated graph.
    1.38 +
    1.39 +template<typename Graph>
    1.40 +SymPetStruct<Graph> addSymPetersen(Graph &G,int num=5)
    1.41 +{
    1.42 +  SymPetStruct<Graph> n;
    1.43 +
    1.44 +  for(int i=0;i<num;i++) {
    1.45 +    n.outer.push_back(G.addNode());
    1.46 +    n.inner.push_back(G.addNode());
    1.47 +  }
    1.48 +
    1.49 + for(int i=0;i<num;i++) {
    1.50 +   n.chords.push_back(G.addEdge(n.outer[i],n.inner[i]));
    1.51 +   n.outcir.push_back(G.addEdge(n.outer[i],n.outer[(i+1)%5]));
    1.52 +   n.incir.push_back(G.addEdge(n.inner[i],n.inner[(i+2)%5]));
    1.53 +  }
    1.54 + return n;
    1.55 +}
    1.56  
    1.57  #endif