[209] | 1 | /* -*- mode: C++; indent-tabs-mode: nil; -*- |
---|
[171] | 2 | * |
---|
[209] | 3 | * This file is a part of LEMON, a generic C++ optimization library. |
---|
[171] | 4 | * |
---|
[440] | 5 | * Copyright (C) 2003-2009 |
---|
[171] | 6 | * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
---|
| 7 | * (Egervary Research Group on Combinatorial Optimization, EGRES). |
---|
| 8 | * |
---|
| 9 | * Permission to use, modify and distribute this software is granted |
---|
| 10 | * provided that this copyright notice appears in all copies. For |
---|
| 11 | * precise terms see the accompanying LICENSE file. |
---|
| 12 | * |
---|
| 13 | * This software is provided "AS IS" with no warranty of any kind, |
---|
| 14 | * express or implied, and with no claim as to its suitability for any |
---|
| 15 | * purpose. |
---|
| 16 | * |
---|
| 17 | */ |
---|
| 18 | |
---|
| 19 | #ifndef LEMON_TEST_GRAPH_TEST_H |
---|
| 20 | #define LEMON_TEST_GRAPH_TEST_H |
---|
| 21 | |
---|
[228] | 22 | #include <set> |
---|
| 23 | |
---|
[220] | 24 | #include <lemon/core.h> |
---|
[228] | 25 | #include <lemon/maps.h> |
---|
| 26 | |
---|
[171] | 27 | #include "test_tools.h" |
---|
| 28 | |
---|
| 29 | namespace lemon { |
---|
| 30 | |
---|
| 31 | template<class Graph> |
---|
| 32 | void checkGraphNodeList(const Graph &G, int cnt) |
---|
| 33 | { |
---|
| 34 | typename Graph::NodeIt n(G); |
---|
| 35 | for(int i=0;i<cnt;i++) { |
---|
| 36 | check(n!=INVALID,"Wrong Node list linking."); |
---|
| 37 | ++n; |
---|
| 38 | } |
---|
| 39 | check(n==INVALID,"Wrong Node list linking."); |
---|
| 40 | check(countNodes(G)==cnt,"Wrong Node number."); |
---|
| 41 | } |
---|
| 42 | |
---|
| 43 | template<class Graph> |
---|
[1019] | 44 | void checkGraphRedNodeList(const Graph &G, int cnt) |
---|
| 45 | { |
---|
[1026] | 46 | typename Graph::RedNodeIt n(G); |
---|
[1019] | 47 | for(int i=0;i<cnt;i++) { |
---|
| 48 | check(n!=INVALID,"Wrong red Node list linking."); |
---|
[1025] | 49 | check(G.red(n),"Wrong node set check."); |
---|
| 50 | check(!G.blue(n),"Wrong node set check."); |
---|
| 51 | typename Graph::Node nn = n; |
---|
| 52 | check(G.asRedNodeUnsafe(nn) == n,"Wrong node conversion."); |
---|
| 53 | check(G.asRedNode(nn) == n,"Wrong node conversion."); |
---|
| 54 | check(G.asBlueNode(nn) == INVALID,"Wrong node conversion."); |
---|
| 55 | std::pair<typename Graph::RedNode, typename Graph::BlueNode> rbn = |
---|
| 56 | G.asRedBlueNode(nn); |
---|
| 57 | check(rbn.first == n,"Wrong node conversion."); |
---|
| 58 | check(rbn.second == INVALID,"Wrong node conversion."); |
---|
[1019] | 59 | ++n; |
---|
| 60 | } |
---|
| 61 | check(n==INVALID,"Wrong red Node list linking."); |
---|
| 62 | check(countRedNodes(G)==cnt,"Wrong red Node number."); |
---|
| 63 | } |
---|
| 64 | |
---|
| 65 | template<class Graph> |
---|
| 66 | void checkGraphBlueNodeList(const Graph &G, int cnt) |
---|
| 67 | { |
---|
[1026] | 68 | typename Graph::BlueNodeIt n(G); |
---|
[1019] | 69 | for(int i=0;i<cnt;i++) { |
---|
| 70 | check(n!=INVALID,"Wrong blue Node list linking."); |
---|
[1025] | 71 | check(G.blue(n),"Wrong node set check."); |
---|
| 72 | check(!G.red(n),"Wrong node set check."); |
---|
| 73 | typename Graph::Node nn = n; |
---|
| 74 | check(G.asBlueNodeUnsafe(nn) == n,"Wrong node conversion."); |
---|
| 75 | check(G.asBlueNode(nn) == n,"Wrong node conversion."); |
---|
| 76 | check(G.asRedNode(nn) == INVALID,"Wrong node conversion."); |
---|
| 77 | std::pair<typename Graph::RedNode, typename Graph::BlueNode> rbn = |
---|
| 78 | G.asRedBlueNode(nn); |
---|
| 79 | check(rbn.first == INVALID,"Wrong node conversion."); |
---|
| 80 | check(rbn.second == n,"Wrong node conversion."); |
---|
[1019] | 81 | ++n; |
---|
| 82 | } |
---|
| 83 | check(n==INVALID,"Wrong blue Node list linking."); |
---|
| 84 | check(countBlueNodes(G)==cnt,"Wrong blue Node number."); |
---|
| 85 | } |
---|
| 86 | |
---|
| 87 | template<class Graph> |
---|
[171] | 88 | void checkGraphArcList(const Graph &G, int cnt) |
---|
| 89 | { |
---|
| 90 | typename Graph::ArcIt e(G); |
---|
| 91 | for(int i=0;i<cnt;i++) { |
---|
| 92 | check(e!=INVALID,"Wrong Arc list linking."); |
---|
[228] | 93 | check(G.oppositeNode(G.source(e), e) == G.target(e), |
---|
| 94 | "Wrong opposite node"); |
---|
| 95 | check(G.oppositeNode(G.target(e), e) == G.source(e), |
---|
| 96 | "Wrong opposite node"); |
---|
[171] | 97 | ++e; |
---|
| 98 | } |
---|
| 99 | check(e==INVALID,"Wrong Arc list linking."); |
---|
| 100 | check(countArcs(G)==cnt,"Wrong Arc number."); |
---|
| 101 | } |
---|
| 102 | |
---|
| 103 | template<class Graph> |
---|
| 104 | void checkGraphOutArcList(const Graph &G, typename Graph::Node n, int cnt) |
---|
| 105 | { |
---|
| 106 | typename Graph::OutArcIt e(G,n); |
---|
| 107 | for(int i=0;i<cnt;i++) { |
---|
| 108 | check(e!=INVALID,"Wrong OutArc list linking."); |
---|
| 109 | check(n==G.source(e),"Wrong OutArc list linking."); |
---|
[228] | 110 | check(n==G.baseNode(e),"Wrong OutArc list linking."); |
---|
| 111 | check(G.target(e)==G.runningNode(e),"Wrong OutArc list linking."); |
---|
[171] | 112 | ++e; |
---|
| 113 | } |
---|
| 114 | check(e==INVALID,"Wrong OutArc list linking."); |
---|
| 115 | check(countOutArcs(G,n)==cnt,"Wrong OutArc number."); |
---|
| 116 | } |
---|
| 117 | |
---|
| 118 | template<class Graph> |
---|
| 119 | void checkGraphInArcList(const Graph &G, typename Graph::Node n, int cnt) |
---|
| 120 | { |
---|
| 121 | typename Graph::InArcIt e(G,n); |
---|
| 122 | for(int i=0;i<cnt;i++) { |
---|
| 123 | check(e!=INVALID,"Wrong InArc list linking."); |
---|
| 124 | check(n==G.target(e),"Wrong InArc list linking."); |
---|
[228] | 125 | check(n==G.baseNode(e),"Wrong OutArc list linking."); |
---|
| 126 | check(G.source(e)==G.runningNode(e),"Wrong OutArc list linking."); |
---|
[171] | 127 | ++e; |
---|
| 128 | } |
---|
| 129 | check(e==INVALID,"Wrong InArc list linking."); |
---|
| 130 | check(countInArcs(G,n)==cnt,"Wrong InArc number."); |
---|
| 131 | } |
---|
| 132 | |
---|
| 133 | template<class Graph> |
---|
| 134 | void checkGraphEdgeList(const Graph &G, int cnt) |
---|
| 135 | { |
---|
| 136 | typename Graph::EdgeIt e(G); |
---|
| 137 | for(int i=0;i<cnt;i++) { |
---|
| 138 | check(e!=INVALID,"Wrong Edge list linking."); |
---|
[228] | 139 | check(G.oppositeNode(G.u(e), e) == G.v(e), "Wrong opposite node"); |
---|
| 140 | check(G.oppositeNode(G.v(e), e) == G.u(e), "Wrong opposite node"); |
---|
[171] | 141 | ++e; |
---|
| 142 | } |
---|
| 143 | check(e==INVALID,"Wrong Edge list linking."); |
---|
| 144 | check(countEdges(G)==cnt,"Wrong Edge number."); |
---|
| 145 | } |
---|
| 146 | |
---|
| 147 | template<class Graph> |
---|
| 148 | void checkGraphIncEdgeList(const Graph &G, typename Graph::Node n, int cnt) |
---|
| 149 | { |
---|
| 150 | typename Graph::IncEdgeIt e(G,n); |
---|
| 151 | for(int i=0;i<cnt;i++) { |
---|
| 152 | check(e!=INVALID,"Wrong IncEdge list linking."); |
---|
| 153 | check(n==G.u(e) || n==G.v(e),"Wrong IncEdge list linking."); |
---|
[228] | 154 | check(n==G.baseNode(e),"Wrong OutArc list linking."); |
---|
| 155 | check(G.u(e)==G.runningNode(e) || G.v(e)==G.runningNode(e), |
---|
| 156 | "Wrong OutArc list linking."); |
---|
[171] | 157 | ++e; |
---|
| 158 | } |
---|
| 159 | check(e==INVALID,"Wrong IncEdge list linking."); |
---|
| 160 | check(countIncEdges(G,n)==cnt,"Wrong IncEdge number."); |
---|
| 161 | } |
---|
| 162 | |
---|
[228] | 163 | template <class Graph> |
---|
[374] | 164 | void checkGraphIncEdgeArcLists(const Graph &G, typename Graph::Node n, |
---|
| 165 | int cnt) |
---|
| 166 | { |
---|
| 167 | checkGraphIncEdgeList(G, n, cnt); |
---|
| 168 | checkGraphOutArcList(G, n, cnt); |
---|
| 169 | checkGraphInArcList(G, n, cnt); |
---|
| 170 | } |
---|
| 171 | |
---|
| 172 | template <class Graph> |
---|
[228] | 173 | void checkGraphConArcList(const Graph &G, int cnt) { |
---|
| 174 | int i = 0; |
---|
| 175 | for (typename Graph::NodeIt u(G); u != INVALID; ++u) { |
---|
| 176 | for (typename Graph::NodeIt v(G); v != INVALID; ++v) { |
---|
| 177 | for (ConArcIt<Graph> a(G, u, v); a != INVALID; ++a) { |
---|
| 178 | check(G.source(a) == u, "Wrong iterator."); |
---|
| 179 | check(G.target(a) == v, "Wrong iterator."); |
---|
| 180 | ++i; |
---|
| 181 | } |
---|
| 182 | } |
---|
| 183 | } |
---|
| 184 | check(cnt == i, "Wrong iterator."); |
---|
[171] | 185 | } |
---|
| 186 | |
---|
| 187 | template <class Graph> |
---|
[228] | 188 | void checkGraphConEdgeList(const Graph &G, int cnt) { |
---|
| 189 | int i = 0; |
---|
| 190 | for (typename Graph::NodeIt u(G); u != INVALID; ++u) { |
---|
| 191 | for (typename Graph::NodeIt v(G); v != INVALID; ++v) { |
---|
| 192 | for (ConEdgeIt<Graph> e(G, u, v); e != INVALID; ++e) { |
---|
| 193 | check((G.u(e) == u && G.v(e) == v) || |
---|
| 194 | (G.u(e) == v && G.v(e) == u), "Wrong iterator."); |
---|
| 195 | i += u == v ? 2 : 1; |
---|
| 196 | } |
---|
| 197 | } |
---|
| 198 | } |
---|
| 199 | check(2 * cnt == i, "Wrong iterator."); |
---|
[171] | 200 | } |
---|
| 201 | |
---|
[228] | 202 | template <typename Graph> |
---|
| 203 | void checkArcDirections(const Graph& G) { |
---|
| 204 | for (typename Graph::ArcIt a(G); a != INVALID; ++a) { |
---|
| 205 | check(G.source(a) == G.target(G.oppositeArc(a)), "Wrong direction"); |
---|
| 206 | check(G.target(a) == G.source(G.oppositeArc(a)), "Wrong direction"); |
---|
| 207 | check(G.direct(a, G.direction(a)) == a, "Wrong direction"); |
---|
[171] | 208 | } |
---|
| 209 | } |
---|
| 210 | |
---|
[228] | 211 | template <typename Graph> |
---|
| 212 | void checkNodeIds(const Graph& G) { |
---|
[1019] | 213 | typedef typename Graph::Node Node; |
---|
[228] | 214 | std::set<int> values; |
---|
| 215 | for (typename Graph::NodeIt n(G); n != INVALID; ++n) { |
---|
| 216 | check(G.nodeFromId(G.id(n)) == n, "Wrong id"); |
---|
| 217 | check(values.find(G.id(n)) == values.end(), "Wrong id"); |
---|
| 218 | check(G.id(n) <= G.maxNodeId(), "Wrong maximum id"); |
---|
| 219 | values.insert(G.id(n)); |
---|
[171] | 220 | } |
---|
[1019] | 221 | check(G.maxId(Node()) <= G.maxNodeId(), "Wrong maximum id"); |
---|
| 222 | } |
---|
| 223 | |
---|
| 224 | template <typename Graph> |
---|
| 225 | void checkRedNodeIds(const Graph& G) { |
---|
| 226 | typedef typename Graph::RedNode RedNode; |
---|
| 227 | std::set<int> values; |
---|
[1026] | 228 | for (typename Graph::RedNodeIt n(G); n != INVALID; ++n) { |
---|
[1019] | 229 | check(G.red(n), "Wrong partition"); |
---|
[1025] | 230 | check(values.find(G.id(n)) == values.end(), "Wrong id"); |
---|
| 231 | check(G.id(n) <= G.maxRedId(), "Wrong maximum id"); |
---|
[1019] | 232 | values.insert(G.id(n)); |
---|
| 233 | } |
---|
| 234 | check(G.maxId(RedNode()) == G.maxRedId(), "Wrong maximum id"); |
---|
| 235 | } |
---|
| 236 | |
---|
| 237 | template <typename Graph> |
---|
| 238 | void checkBlueNodeIds(const Graph& G) { |
---|
| 239 | typedef typename Graph::BlueNode BlueNode; |
---|
| 240 | std::set<int> values; |
---|
[1026] | 241 | for (typename Graph::BlueNodeIt n(G); n != INVALID; ++n) { |
---|
[1019] | 242 | check(G.blue(n), "Wrong partition"); |
---|
[1025] | 243 | check(values.find(G.id(n)) == values.end(), "Wrong id"); |
---|
| 244 | check(G.id(n) <= G.maxBlueId(), "Wrong maximum id"); |
---|
[1019] | 245 | values.insert(G.id(n)); |
---|
| 246 | } |
---|
| 247 | check(G.maxId(BlueNode()) == G.maxBlueId(), "Wrong maximum id"); |
---|
[171] | 248 | } |
---|
| 249 | |
---|
[228] | 250 | template <typename Graph> |
---|
| 251 | void checkArcIds(const Graph& G) { |
---|
[1019] | 252 | typedef typename Graph::Arc Arc; |
---|
[228] | 253 | std::set<int> values; |
---|
| 254 | for (typename Graph::ArcIt a(G); a != INVALID; ++a) { |
---|
| 255 | check(G.arcFromId(G.id(a)) == a, "Wrong id"); |
---|
| 256 | check(values.find(G.id(a)) == values.end(), "Wrong id"); |
---|
| 257 | check(G.id(a) <= G.maxArcId(), "Wrong maximum id"); |
---|
| 258 | values.insert(G.id(a)); |
---|
| 259 | } |
---|
[1019] | 260 | check(G.maxId(Arc()) <= G.maxArcId(), "Wrong maximum id"); |
---|
[171] | 261 | } |
---|
[209] | 262 | |
---|
[228] | 263 | template <typename Graph> |
---|
| 264 | void checkEdgeIds(const Graph& G) { |
---|
[1019] | 265 | typedef typename Graph::Edge Edge; |
---|
[228] | 266 | std::set<int> values; |
---|
| 267 | for (typename Graph::EdgeIt e(G); e != INVALID; ++e) { |
---|
| 268 | check(G.edgeFromId(G.id(e)) == e, "Wrong id"); |
---|
| 269 | check(values.find(G.id(e)) == values.end(), "Wrong id"); |
---|
| 270 | check(G.id(e) <= G.maxEdgeId(), "Wrong maximum id"); |
---|
| 271 | values.insert(G.id(e)); |
---|
| 272 | } |
---|
[1019] | 273 | check(G.maxId(Edge()) <= G.maxEdgeId(), "Wrong maximum id"); |
---|
[171] | 274 | } |
---|
| 275 | |
---|
[228] | 276 | template <typename Graph> |
---|
| 277 | void checkGraphNodeMap(const Graph& G) { |
---|
| 278 | typedef typename Graph::Node Node; |
---|
| 279 | typedef typename Graph::NodeIt NodeIt; |
---|
| 280 | |
---|
| 281 | typedef typename Graph::template NodeMap<int> IntNodeMap; |
---|
| 282 | IntNodeMap map(G, 42); |
---|
| 283 | for (NodeIt it(G); it != INVALID; ++it) { |
---|
| 284 | check(map[it] == 42, "Wrong map constructor."); |
---|
| 285 | } |
---|
| 286 | int s = 0; |
---|
| 287 | for (NodeIt it(G); it != INVALID; ++it) { |
---|
| 288 | map[it] = 0; |
---|
| 289 | check(map[it] == 0, "Wrong operator[]."); |
---|
| 290 | map.set(it, s); |
---|
| 291 | check(map[it] == s, "Wrong set."); |
---|
| 292 | ++s; |
---|
| 293 | } |
---|
| 294 | s = s * (s - 1) / 2; |
---|
| 295 | for (NodeIt it(G); it != INVALID; ++it) { |
---|
| 296 | s -= map[it]; |
---|
| 297 | } |
---|
| 298 | check(s == 0, "Wrong sum."); |
---|
| 299 | |
---|
[263] | 300 | // map = constMap<Node>(12); |
---|
| 301 | // for (NodeIt it(G); it != INVALID; ++it) { |
---|
| 302 | // check(map[it] == 12, "Wrong operator[]."); |
---|
| 303 | // } |
---|
[228] | 304 | } |
---|
| 305 | |
---|
| 306 | template <typename Graph> |
---|
[1026] | 307 | void checkGraphRedNodeMap(const Graph& G) { |
---|
[1019] | 308 | typedef typename Graph::Node Node; |
---|
[1026] | 309 | typedef typename Graph::RedNodeIt RedNodeIt; |
---|
[1019] | 310 | |
---|
[1026] | 311 | typedef typename Graph::template RedNodeMap<int> IntRedNodeMap; |
---|
| 312 | IntRedNodeMap map(G, 42); |
---|
| 313 | for (RedNodeIt it(G); it != INVALID; ++it) { |
---|
[1019] | 314 | check(map[it] == 42, "Wrong map constructor."); |
---|
| 315 | } |
---|
| 316 | int s = 0; |
---|
[1026] | 317 | for (RedNodeIt it(G); it != INVALID; ++it) { |
---|
[1019] | 318 | map[it] = 0; |
---|
| 319 | check(map[it] == 0, "Wrong operator[]."); |
---|
| 320 | map.set(it, s); |
---|
| 321 | check(map[it] == s, "Wrong set."); |
---|
| 322 | ++s; |
---|
| 323 | } |
---|
| 324 | s = s * (s - 1) / 2; |
---|
[1026] | 325 | for (RedNodeIt it(G); it != INVALID; ++it) { |
---|
[1019] | 326 | s -= map[it]; |
---|
| 327 | } |
---|
| 328 | check(s == 0, "Wrong sum."); |
---|
| 329 | |
---|
| 330 | // map = constMap<Node>(12); |
---|
| 331 | // for (NodeIt it(G); it != INVALID; ++it) { |
---|
| 332 | // check(map[it] == 12, "Wrong operator[]."); |
---|
| 333 | // } |
---|
| 334 | } |
---|
| 335 | |
---|
| 336 | template <typename Graph> |
---|
[1026] | 337 | void checkGraphBlueNodeMap(const Graph& G) { |
---|
[1019] | 338 | typedef typename Graph::Node Node; |
---|
[1026] | 339 | typedef typename Graph::BlueNodeIt BlueNodeIt; |
---|
[1019] | 340 | |
---|
[1026] | 341 | typedef typename Graph::template BlueNodeMap<int> IntBlueNodeMap; |
---|
| 342 | IntBlueNodeMap map(G, 42); |
---|
| 343 | for (BlueNodeIt it(G); it != INVALID; ++it) { |
---|
[1019] | 344 | check(map[it] == 42, "Wrong map constructor."); |
---|
| 345 | } |
---|
| 346 | int s = 0; |
---|
[1026] | 347 | for (BlueNodeIt it(G); it != INVALID; ++it) { |
---|
[1019] | 348 | map[it] = 0; |
---|
| 349 | check(map[it] == 0, "Wrong operator[]."); |
---|
| 350 | map.set(it, s); |
---|
| 351 | check(map[it] == s, "Wrong set."); |
---|
| 352 | ++s; |
---|
| 353 | } |
---|
| 354 | s = s * (s - 1) / 2; |
---|
[1026] | 355 | for (BlueNodeIt it(G); it != INVALID; ++it) { |
---|
[1019] | 356 | s -= map[it]; |
---|
| 357 | } |
---|
| 358 | check(s == 0, "Wrong sum."); |
---|
| 359 | |
---|
| 360 | // map = constMap<Node>(12); |
---|
| 361 | // for (NodeIt it(G); it != INVALID; ++it) { |
---|
| 362 | // check(map[it] == 12, "Wrong operator[]."); |
---|
| 363 | // } |
---|
| 364 | } |
---|
| 365 | |
---|
| 366 | template <typename Graph> |
---|
[228] | 367 | void checkGraphArcMap(const Graph& G) { |
---|
| 368 | typedef typename Graph::Arc Arc; |
---|
| 369 | typedef typename Graph::ArcIt ArcIt; |
---|
| 370 | |
---|
| 371 | typedef typename Graph::template ArcMap<int> IntArcMap; |
---|
| 372 | IntArcMap map(G, 42); |
---|
| 373 | for (ArcIt it(G); it != INVALID; ++it) { |
---|
| 374 | check(map[it] == 42, "Wrong map constructor."); |
---|
| 375 | } |
---|
| 376 | int s = 0; |
---|
| 377 | for (ArcIt it(G); it != INVALID; ++it) { |
---|
| 378 | map[it] = 0; |
---|
| 379 | check(map[it] == 0, "Wrong operator[]."); |
---|
| 380 | map.set(it, s); |
---|
| 381 | check(map[it] == s, "Wrong set."); |
---|
| 382 | ++s; |
---|
| 383 | } |
---|
| 384 | s = s * (s - 1) / 2; |
---|
| 385 | for (ArcIt it(G); it != INVALID; ++it) { |
---|
| 386 | s -= map[it]; |
---|
| 387 | } |
---|
| 388 | check(s == 0, "Wrong sum."); |
---|
| 389 | |
---|
[263] | 390 | // map = constMap<Arc>(12); |
---|
| 391 | // for (ArcIt it(G); it != INVALID; ++it) { |
---|
| 392 | // check(map[it] == 12, "Wrong operator[]."); |
---|
| 393 | // } |
---|
[228] | 394 | } |
---|
| 395 | |
---|
| 396 | template <typename Graph> |
---|
| 397 | void checkGraphEdgeMap(const Graph& G) { |
---|
| 398 | typedef typename Graph::Edge Edge; |
---|
| 399 | typedef typename Graph::EdgeIt EdgeIt; |
---|
| 400 | |
---|
| 401 | typedef typename Graph::template EdgeMap<int> IntEdgeMap; |
---|
| 402 | IntEdgeMap map(G, 42); |
---|
| 403 | for (EdgeIt it(G); it != INVALID; ++it) { |
---|
| 404 | check(map[it] == 42, "Wrong map constructor."); |
---|
| 405 | } |
---|
| 406 | int s = 0; |
---|
| 407 | for (EdgeIt it(G); it != INVALID; ++it) { |
---|
| 408 | map[it] = 0; |
---|
| 409 | check(map[it] == 0, "Wrong operator[]."); |
---|
| 410 | map.set(it, s); |
---|
| 411 | check(map[it] == s, "Wrong set."); |
---|
| 412 | ++s; |
---|
| 413 | } |
---|
| 414 | s = s * (s - 1) / 2; |
---|
| 415 | for (EdgeIt it(G); it != INVALID; ++it) { |
---|
| 416 | s -= map[it]; |
---|
| 417 | } |
---|
| 418 | check(s == 0, "Wrong sum."); |
---|
| 419 | |
---|
[263] | 420 | // map = constMap<Edge>(12); |
---|
| 421 | // for (EdgeIt it(G); it != INVALID; ++it) { |
---|
| 422 | // check(map[it] == 12, "Wrong operator[]."); |
---|
| 423 | // } |
---|
[228] | 424 | } |
---|
| 425 | |
---|
| 426 | |
---|
[171] | 427 | } //namespace lemon |
---|
| 428 | |
---|
| 429 | #endif |
---|