author | alpar |
Wed, 22 Sep 2004 09:58:17 +0000 | |
changeset 900 | fc7bc2dacee5 |
parent 63 | 8a39e8b9cdd7 |
child 921 | 818510fa3d99 |
permissions | -rw-r--r-- |
ladanyi@63 | 1 |
#include <vector> |
ladanyi@63 | 2 |
#include <iostream> |
ladanyi@63 | 3 |
#include <list_graph.hh> |
ladanyi@63 | 4 |
#include <bfs_iterator.hh> |
ladanyi@63 | 5 |
#include <loader.h> |
ladanyi@63 | 6 |
|
alpar@106 | 7 |
using namespace hugo; |
ladanyi@63 | 8 |
|
ladanyi@63 | 9 |
int main(int, char **) { |
ladanyi@63 | 10 |
typedef ListGraph::NodeIt NodeIt; |
ladanyi@63 | 11 |
typedef ListGraph::EdgeIt EdgeIt; |
ladanyi@63 | 12 |
typedef ListGraph::EachNodeIt EachNodeIt; |
ladanyi@63 | 13 |
typedef ListGraph::EachEdgeIt EachEdgeIt; |
ladanyi@63 | 14 |
typedef ListGraph::OutEdgeIt OutEdgeIt; |
ladanyi@63 | 15 |
typedef ListGraph::InEdgeIt InEdgeIt; |
ladanyi@63 | 16 |
typedef ListGraph::SymEdgeIt SymEdgeIt; |
ladanyi@63 | 17 |
|
ladanyi@63 | 18 |
ListGraph G; |
ladanyi@63 | 19 |
LoadGraph(G, "demo.in"); |
ladanyi@63 | 20 |
|
ladanyi@63 | 21 |
std::cout << "bfs from the first node" << std::endl; |
ladanyi@63 | 22 |
bfs<ListGraph> bfs_test(G, G.first<EachNodeIt>()); |
ladanyi@63 | 23 |
bfs_test.run(); |
ladanyi@63 | 24 |
std::cout << "reached: "; |
ladanyi@63 | 25 |
for(EachNodeIt i=G.first<EachNodeIt>(); i.valid(); ++i) { |
ladanyi@63 | 26 |
std::cout << bfs_test.reached.get(i) << " "; |
ladanyi@63 | 27 |
} |
ladanyi@63 | 28 |
std::cout<<std::endl; |
ladanyi@63 | 29 |
std::cout << "dist: "; |
ladanyi@63 | 30 |
for(EachNodeIt i=G.first<EachNodeIt>(); i.valid(); ++i) { |
ladanyi@63 | 31 |
std::cout << bfs_test.dist.get(i) << " "; |
ladanyi@63 | 32 |
} |
ladanyi@63 | 33 |
std::cout<<std::endl; |
ladanyi@63 | 34 |
} |