| ... | ... |
@@ -16,57 +16,57 @@ |
| 16 | 16 |
* |
| 17 | 17 |
*/ |
| 18 | 18 |
|
| 19 | 19 |
#include <lemon/euler.h> |
| 20 | 20 |
#include <lemon/list_graph.h> |
| 21 | 21 |
#include <test/test_tools.h> |
| 22 | 22 |
|
| 23 | 23 |
using namespace lemon; |
| 24 | 24 |
|
| 25 | 25 |
template <typename Digraph> |
| 26 | 26 |
void checkDiEulerIt(const Digraph& g) |
| 27 | 27 |
{
|
| 28 |
typename Digraph::template ArcMap<int> visitationNumber(g); |
|
| 28 |
typename Digraph::template ArcMap<int> visitationNumber(g, 0); |
|
| 29 | 29 |
|
| 30 | 30 |
DiEulerIt<Digraph> e(g); |
| 31 | 31 |
typename Digraph::Node firstNode = g.source(e); |
| 32 |
typename Digraph::Node lastNode; |
|
| 32 |
typename Digraph::Node lastNode = g.target(e); |
|
| 33 | 33 |
|
| 34 | 34 |
for (; e != INVALID; ++e) |
| 35 | 35 |
{
|
| 36 | 36 |
if (e != INVALID) |
| 37 | 37 |
{
|
| 38 | 38 |
lastNode = g.target(e); |
| 39 | 39 |
} |
| 40 | 40 |
++visitationNumber[e]; |
| 41 | 41 |
} |
| 42 | 42 |
|
| 43 | 43 |
check(firstNode == lastNode, |
| 44 | 44 |
"checkDiEulerIt: first and last node are not the same"); |
| 45 | 45 |
|
| 46 | 46 |
for (typename Digraph::ArcIt a(g); a != INVALID; ++a) |
| 47 | 47 |
{
|
| 48 | 48 |
check(visitationNumber[a] == 1, |
| 49 | 49 |
"checkDiEulerIt: not visited or multiple times visited arc found"); |
| 50 | 50 |
} |
| 51 | 51 |
} |
| 52 | 52 |
|
| 53 | 53 |
template <typename Graph> |
| 54 | 54 |
void checkEulerIt(const Graph& g) |
| 55 | 55 |
{
|
| 56 |
typename Graph::template EdgeMap<int> visitationNumber(g); |
|
| 56 |
typename Graph::template EdgeMap<int> visitationNumber(g, 0); |
|
| 57 | 57 |
|
| 58 | 58 |
EulerIt<Graph> e(g); |
| 59 | 59 |
typename Graph::Node firstNode = g.u(e); |
| 60 |
typename Graph::Node lastNode; |
|
| 60 |
typename Graph::Node lastNode = g.v(e); |
|
| 61 | 61 |
|
| 62 | 62 |
for (; e != INVALID; ++e) |
| 63 | 63 |
{
|
| 64 | 64 |
if (e != INVALID) |
| 65 | 65 |
{
|
| 66 | 66 |
lastNode = g.v(e); |
| 67 | 67 |
} |
| 68 | 68 |
++visitationNumber[e]; |
| 69 | 69 |
} |
| 70 | 70 |
|
| 71 | 71 |
check(firstNode == lastNode, |
| 72 | 72 |
"checkEulerIt: first and last node are not the same"); |
0 comments (0 inline)