131 checkGraphInEdgeList(G, n, 3); |
131 checkGraphInEdgeList(G, n, 3); |
132 checkGraphOutEdgeList(G, n, 3); |
132 checkGraphOutEdgeList(G, n, 3); |
133 } |
133 } |
134 } |
134 } |
135 |
135 |
136 ///Structure returned by \ref addUndirPetersen(). |
136 ///Structure returned by \ref addUPetersen(). |
137 |
137 |
138 ///Structure returned by \ref addUndirPetersen(). |
138 ///Structure returned by \ref addUPetersen(). |
139 /// |
139 /// |
140 template<class Graph> struct UndirPetStruct |
140 template<class Graph> struct UPetStruct |
141 { |
141 { |
142 ///Vector containing the outer nodes. |
142 ///Vector containing the outer nodes. |
143 std::vector<typename Graph::Node> outer; |
143 std::vector<typename Graph::Node> outer; |
144 ///Vector containing the inner nodes. |
144 ///Vector containing the inner nodes. |
145 std::vector<typename Graph::Node> inner; |
145 std::vector<typename Graph::Node> inner; |
146 ///Vector containing the edges of the inner circle. |
146 ///Vector containing the edges of the inner circle. |
147 std::vector<typename Graph::UndirEdge> incir; |
147 std::vector<typename Graph::UEdge> incir; |
148 ///Vector containing the edges of the outer circle. |
148 ///Vector containing the edges of the outer circle. |
149 std::vector<typename Graph::UndirEdge> outcir; |
149 std::vector<typename Graph::UEdge> outcir; |
150 ///Vector containing the chord edges. |
150 ///Vector containing the chord edges. |
151 std::vector<typename Graph::UndirEdge> chords; |
151 std::vector<typename Graph::UEdge> chords; |
152 }; |
152 }; |
153 |
153 |
154 ///Adds a Petersen graph to the undirected \c G. |
154 ///Adds a Petersen graph to the undirected \c G. |
155 |
155 |
156 ///Adds a Petersen graph to the undirected \c G. |
156 ///Adds a Petersen graph to the undirected \c G. |
157 ///\return The nodes and edges of the generated graph. |
157 ///\return The nodes and edges of the generated graph. |
158 |
158 |
159 template<typename Graph> |
159 template<typename Graph> |
160 UndirPetStruct<Graph> addUndirPetersen(Graph &G,int num=5) |
160 UPetStruct<Graph> addUPetersen(Graph &G,int num=5) |
161 { |
161 { |
162 UndirPetStruct<Graph> n; |
162 UPetStruct<Graph> n; |
163 |
163 |
164 for(int i=0;i<num;i++) { |
164 for(int i=0;i<num;i++) { |
165 n.outer.push_back(G.addNode()); |
165 n.outer.push_back(G.addNode()); |
166 n.inner.push_back(G.addNode()); |
166 n.inner.push_back(G.addNode()); |
167 } |
167 } |