1.1 --- a/src/work/athos/bfs_test.cc Sun Apr 17 18:57:22 2005 +0000
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,79 +0,0 @@
1.4 -// -*- c++ -*-
1.5 -#include <iostream>
1.6 -#include <fstream>
1.7 -
1.8 -#include <sage_graph.h>
1.9 -//#include <smart_graph.h>
1.10 -#include <lemon/dimacs.h>
1.11 -#include <lemon/time_measure.h>
1.12 -#include <lemon/for_each_macros.h>
1.13 -#include <bfs_dfs.h>
1.14 -
1.15 -using namespace lemon;
1.16 -
1.17 -int main() {
1.18 - typedef SageGraph Graph;
1.19 - typedef Graph::Node Node;
1.20 - typedef Graph::NodeIt NodeIt;
1.21 - typedef Graph::Edge Edge;
1.22 - typedef Graph::EdgeIt EdgeIt;
1.23 - typedef Graph::OutEdgeIt OutEdgeIt;
1.24 -
1.25 - Graph g;
1.26 - Node s, t;
1.27 - Graph::EdgeMap<int> cap(g);
1.28 - //readDimacsMaxFlow(std::cin, g, s, t, cap);
1.29 - readDimacs(std::cin, g);
1.30 -
1.31 - Graph::NodeMap<OutEdgeIt> pred(g);
1.32 -
1.33 - Timer ts;
1.34 - /*
1.35 - {
1.36 - ts.reset();
1.37 - Graph::NodeMap<bool> reached(g);
1.38 - reached.set(s, true);
1.39 - pred.set(s, INVALID);
1.40 - std::queue<Node> bfs_queue;
1.41 - bfs_queue.push(t);
1.42 - while (!bfs_queue.empty()) {
1.43 - Node v=bfs_queue.front();
1.44 - bfs_queue.pop();
1.45 - OutEdgeIt e;
1.46 - for(g.first(e,v); g.valid(e); g.next(e)) {
1.47 - Node w=g.target(e);
1.48 - if (!reached[w]) {
1.49 - bfs_queue.push(w);
1.50 - reached.set(w, true);
1.51 - pred.set(w, e);
1.52 - }
1.53 - }
1.54 - }
1.55 -
1.56 - std::cout << ts << std::endl;
1.57 - }
1.58 - */
1.59 -
1.60 - {
1.61 - ts.reset();
1.62 - Graph::NodeMap<bool> bfs_reached(g);
1.63 - Graph::NodeMap<Edge> bfs_pred(g);
1.64 - Graph::NodeMap<int> bfs_dist(g);
1.65 -
1.66 - Bfs< Graph, Graph::NodeMap<bool>,
1.67 - Graph::NodeMap<Edge>, Graph::NodeMap<int> >
1.68 - bfs(g,bfs_reached, bfs_pred, bfs_dist );
1.69 - bfs.run(s);
1.70 - /*
1.71 - pred.set(s, INVALID);
1.72 - while (!bfs.finished()) {
1.73 - ++bfs;
1.74 - if (g.valid(bfs) && bfs.isBNodeNewlyReached())
1.75 - pred.set(bfs.bNode(), bfs);
1.76 - }
1.77 - */
1.78 - std::cout << ts << std::endl;
1.79 - }
1.80 -
1.81 - return 0;
1.82 -}