Unify the spelling of LEMON (#103).
1 /* -*- mode: C++; indent-tabs-mode: nil; -*-
3 * This file is a part of LEMON, a generic C++ optimization library.
5 * Copyright (C) 2003-2008
6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
7 * (Egervary Research Group on Combinatorial Optimization, EGRES).
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.
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
19 #include <lemon/concepts/digraph.h>
20 #include <lemon/smart_graph.h>
21 #include <lemon/list_graph.h>
22 #include <lemon/lgf_reader.h>
24 #include <lemon/dfs.h>
25 #include <lemon/path.h>
27 #include "graph_test.h"
28 #include "test_tools.h"
30 using namespace lemon;
56 void checkDfsCompile()
58 typedef concepts::Digraph Digraph;
59 typedef Dfs<Digraph> DType;
74 e = dfs_test.predArc(n);
75 n = dfs_test.predNode(n);
76 d = dfs_test.distMap();
77 p = dfs_test.predMap();
78 b = dfs_test.reached(n);
80 Path<Digraph> pp = dfs_test.path(n);
83 void checkDfsFunctionCompile()
86 typedef concepts::Digraph Digraph;
87 typedef Digraph::Arc Arc;
88 typedef Digraph::Node Node;
92 dfs(g).source(Node()).run();
94 .predMap(concepts::WriteMap<Node,Arc>())
95 .distMap(concepts::WriteMap<Node,VType>())
96 .reachedMap(concepts::ReadWriteMap<Node,bool>())
97 .processedMap(concepts::WriteMap<Node,bool>())
101 template <class Digraph>
103 TEMPLATE_DIGRAPH_TYPEDEFS(Digraph);
108 std::istringstream input(test_lgf);
109 digraphReader(input, G).
114 Dfs<Digraph> dfs_test(G);
117 Path<Digraph> p = dfs_test.path(t);
118 check(p.length() == dfs_test.dist(t),"path() found a wrong path.");
119 check(checkPath(G, p),"path() found a wrong path.");
120 check(pathSource(G, p) == s,"path() found a wrong path.");
121 check(pathTarget(G, p) == t,"path() found a wrong path.");
123 for(NodeIt v(G); v!=INVALID; ++v) {
124 if (dfs_test.reached(v)) {
125 check(v==s || dfs_test.predArc(v)!=INVALID, "Wrong tree.");
126 if (dfs_test.predArc(v)!=INVALID ) {
127 Arc e=dfs_test.predArc(v);
129 check(u==dfs_test.predNode(v),"Wrong tree.");
130 check(dfs_test.dist(v) - dfs_test.dist(u) == 1,
131 "Wrong distance. (" << dfs_test.dist(u) << "->"
132 <<dfs_test.dist(v) << ')');
140 checkDfs<ListDigraph>();
141 checkDfs<SmartDigraph>();