COIN-OR::LEMON - Graph Library

Changeset 946:c94ef40a22ce in lemon-0.x for src/test/test_tools.h


Ignore:
Timestamp:
10/28/04 00:38:50 (17 years ago)
Author:
Mihaly Barasz
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1322
Message:

The graph_factory branch (@ 1321) has been merged to trunk.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/test/test_tools.h

    r937 r946  
    7171
    7272template<typename Graph>
    73 PetStruct<Graph> addPetersen(Graph &G,int num=5)
     73PetStruct<Graph> addPetersen(Graph &G,int num = 5)
    7474{
    7575  PetStruct<Graph> n;
     
    8282 for(int i=0;i<num;i++) {
    8383   n.chords.push_back(G.addEdge(n.outer[i],n.inner[i]));
    84    n.outcir.push_back(G.addEdge(n.outer[i],n.outer[(i+1)%5]));
    85    n.incir.push_back(G.addEdge(n.inner[i],n.inner[(i+2)%5]));
     84   n.outcir.push_back(G.addEdge(n.outer[i],n.outer[(i+1) % num]));
     85   n.incir.push_back(G.addEdge(n.inner[i],n.inner[(i+2) % num]));
    8686  }
    8787 return n;
     88}
     89
     90/// \brief Adds to the graph the reverse pair of all edge.
     91///
     92/// Adds to the graph the reverse pair of all edge.
     93///
     94template<class Graph> void bidirGraph(Graph &G)
     95{
     96  typedef typename Graph::Edge Edge;
     97  typedef typename Graph::EdgeIt EdgeIt;
     98 
     99  std::vector<Edge> ee;
     100 
     101  for(EdgeIt e(G);e!=INVALID;++e) ee.push_back(e);
     102
     103  for(typename std::vector<Edge>::iterator p=ee.begin();p!=ee.end();p++)
     104    G.addEdge(G.head(*p),G.tail(*p));
     105}
     106
     107
     108/// \brief Checks the bidirectioned Petersen graph.
     109///
     110///  Checks the bidirectioned Petersen graph.
     111///
     112template<class Graph> void checkBidirPetersen(Graph &G, int num = 5)
     113{
     114  typedef typename Graph::Node Node;
     115
     116  typedef typename Graph::EdgeIt EdgeIt;
     117  typedef typename Graph::NodeIt NodeIt;
     118
     119  checkGraphNodeList(G, 2 * num);
     120  checkGraphEdgeList(G, 6 * num);
     121
     122  for(NodeIt n(G);n!=INVALID;++n) {
     123    checkGraphInEdgeList(G, n, 3);
     124    checkGraphOutEdgeList(G, n, 3);
     125  } 
    88126}
    89127
Note: See TracChangeset for help on using the changeset viewer.