src/work/akos/loader_demo.cc
author alpar
Sat, 30 Oct 2004 18:30:29 +0000
changeset 949 b16a10926781
parent 106 0508d63fcc96
permissions -rw-r--r--
ListGraph compilation bug fixed.
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@921
     7
using namespace lemon;
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
}