Update INSTALL file.
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>
23 #include <lemon/bfs.h>
24 #include <lemon/path.h>
26 #include "graph_test.h"
27 #include "test_tools.h"
29 using namespace lemon;
53 void checkBfsCompile()
55 typedef concepts::Digraph Digraph;
56 typedef Bfs<Digraph> BType;
65 // BType::PredNodeMap pn(G);
72 e = bfs_test.predArc(n);
73 n = bfs_test.predNode(n);
74 d = bfs_test.distMap();
76 p = bfs_test.predMap();
77 // pn = bfs_test.predNodeMap();
78 b = bfs_test.reached(n);
80 Path<Digraph> pp = bfs_test.path(n);
83 void checkBfsFunctionCompile()
86 typedef concepts::Digraph Digraph;
87 typedef Digraph::Arc Arc;
88 typedef Digraph::Node Node;
92 bfs(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 Bfs<Digraph> bfs_test(G);
117 check(bfs_test.dist(t)==2,"Bfs found a wrong path." << bfs_test.dist(t));
119 Path<Digraph> p = bfs_test.path(t);
120 check(p.length()==2,"path() found a wrong path.");
121 check(checkPath(G, p),"path() found a wrong path.");
122 check(pathSource(G, p) == s,"path() found a wrong path.");
123 check(pathTarget(G, p) == t,"path() found a wrong path.");
126 for(ArcIt a(G); a!=INVALID; ++a) {
129 check( !bfs_test.reached(u) ||
130 (bfs_test.dist(v) <= bfs_test.dist(u)+1),
131 "Wrong output." << G.id(v) << ' ' << G.id(u));
134 for(NodeIt v(G); v!=INVALID; ++v) {
135 if (bfs_test.reached(v)) {
136 check(v==s || bfs_test.predArc(v)!=INVALID, "Wrong tree.");
137 if (bfs_test.predArc(v)!=INVALID ) {
138 Arc a=bfs_test.predArc(v);
140 check(u==bfs_test.predNode(v),"Wrong tree.");
141 check(bfs_test.dist(v) - bfs_test.dist(u) == 1,
142 "Wrong distance. Difference: "
143 << std::abs(bfs_test.dist(v) - bfs_test.dist(u)
152 checkBfs<ListDigraph>();
153 checkBfs<SmartDigraph>();