Changeset 946:c94ef40a22ce in lemon0.x for src/test/test_tools.h
 Timestamp:
 10/28/04 00:38:50 (20 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@1322
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

src/test/test_tools.h
r937 r946 71 71 72 72 template<typename Graph> 73 PetStruct<Graph> addPetersen(Graph &G,int num =5)73 PetStruct<Graph> addPetersen(Graph &G,int num = 5) 74 74 { 75 75 PetStruct<Graph> n; … … 82 82 for(int i=0;i<num;i++) { 83 83 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])); 86 86 } 87 87 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 /// 94 template<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 /// 112 template<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 } 88 126 } 89 127
Note: See TracChangeset
for help on using the changeset viewer.