src/work/deba/main.cpp
author ladanyi
Fri, 28 May 2004 07:48:16 +0000
changeset 666 410a1419e86b
parent 595 e10b5e9419ef
child 674 7733d18de0e8
permissions -rw-r--r--
Added a short tutorial on using graphs.
deba@378
     1
#include <iostream>
deba@595
     2
#include <cstdlib>
deba@378
     3
#include "test_graph.h"
deba@378
     4
deba@378
     5
using namespace std;
deba@378
     6
using namespace hugo;
deba@378
     7
deba@378
     8
deba@378
     9
int main() {
deba@627
    10
  ListGraph g;
deba@627
    11
  for (int i = 0; i < 10; ++i) {
deba@627
    12
    ListGraph::Node node = g.addNode();
deba@627
    13
  }
deba@627
    14
  ListGraph::NodeMapFactory::Map<int> map(g, g.node_maps);
deba@627
    15
  for (int i = 0; i < 10; ++i) {
deba@627
    16
    ListGraph::Node node = g.addNode();
deba@627
    17
    map[node] = rand()%100;
deba@627
    18
  }
deba@627
    19
  for (ListGraph::NodeIt it(g); g.valid(it); g.next(it)) {
deba@627
    20
    cout << map[it] << endl;
deba@627
    21
  }
deba@627
    22
  return 0;
deba@378
    23
}
deba@378
    24