demo/hello_lemon.cc
author athos
Tue, 28 Jun 2005 17:46:35 +0000
changeset 1522 321661278137
child 1526 8c14aa8f27a2
permissions -rw-r--r--
Some corrections to graph_io.dox (mainly language corrections). Improvements on quicktour.
klao@1520
     1
#include <iostream>
klao@1520
     2
#include <lemon/list_graph.h>
klao@1520
     3
klao@1520
     4
int main()
klao@1520
     5
{
klao@1520
     6
  typedef lemon::ListGraph Graph;
klao@1520
     7
  typedef Graph::EdgeIt EdgeIt;
klao@1520
     8
  typedef Graph::NodeIt NodeIt;
klao@1520
     9
  using lemon::INVALID;
klao@1520
    10
klao@1520
    11
  Graph g;
klao@1520
    12
  
klao@1520
    13
  for (int i = 0; i < 3; i++)
klao@1520
    14
    g.addNode();
klao@1520
    15
  
klao@1520
    16
  for (NodeIt i(g); i!=INVALID; ++i)
klao@1520
    17
    for (NodeIt j(g); j!=INVALID; ++j)
klao@1520
    18
      if (i != j) g.addEdge(i, j);
klao@1520
    19
klao@1520
    20
  std::cout << "Nodes:";
klao@1520
    21
  for (NodeIt i(g); i!=INVALID; ++i)
klao@1520
    22
    std::cout << " " << g.id(i);
klao@1520
    23
  std::cout << std::endl;
klao@1520
    24
klao@1520
    25
  std::cout << "Edges:";
klao@1520
    26
  for (EdgeIt i(g); i!=INVALID; ++i)
klao@1520
    27
    std::cout << " (" << g.id(g.source(i)) << "," << g.id(g.target(i)) << ")";
klao@1520
    28
  std::cout << std::endl;
klao@1520
    29
}