src/work/akos/loader_demo.cc
author deba
Wed, 08 Sep 2004 12:06:45 +0000 (2004-09-08)
changeset 822 88226d9fe821
parent 63 8a39e8b9cdd7
child 921 818510fa3d99
permissions -rw-r--r--
The MapFactories have been removed from the code because
if we use macros then they increases only the complexity.

The pair iterators of the maps are separeted from the maps.

Some macros and comments has been changed.
     1 #include <vector>
     2 #include <iostream>
     3 #include <list_graph.hh>
     4 #include <bfs_iterator.hh>
     5 #include <loader.h>
     6 
     7 using namespace hugo;
     8 
     9 int main(int, char **) {
    10   typedef ListGraph::NodeIt NodeIt;
    11   typedef ListGraph::EdgeIt EdgeIt;
    12   typedef ListGraph::EachNodeIt EachNodeIt;
    13   typedef ListGraph::EachEdgeIt EachEdgeIt;
    14   typedef ListGraph::OutEdgeIt OutEdgeIt;
    15   typedef ListGraph::InEdgeIt InEdgeIt;
    16   typedef ListGraph::SymEdgeIt SymEdgeIt;
    17 
    18   ListGraph G;
    19   LoadGraph(G, "demo.in");
    20 
    21   std::cout << "bfs from the first node" << std::endl;
    22   bfs<ListGraph> bfs_test(G, G.first<EachNodeIt>());
    23   bfs_test.run();
    24   std::cout << "reached: ";
    25   for(EachNodeIt i=G.first<EachNodeIt>(); i.valid(); ++i) {
    26     std::cout << bfs_test.reached.get(i) << " ";
    27   }
    28   std::cout<<std::endl;
    29   std::cout << "dist: ";
    30   for(EachNodeIt i=G.first<EachNodeIt>(); i.valid(); ++i) {
    31     std::cout << bfs_test.dist.get(i) << " ";
    32   }
    33   std::cout<<std::endl;
    34 }