src/demo/helloworld.cc
author athos
Fri, 25 Mar 2005 15:32:05 +0000
changeset 1262 61f989e3e525
permissions -rw-r--r--
This was a bug, I guess
athos@1181
     1
#include <iostream>
athos@1181
     2
#include <lemon/list_graph.h>
athos@1181
     3
athos@1181
     4
using namespace lemon;
athos@1181
     5
athos@1181
     6
int main()
athos@1181
     7
{
athos@1181
     8
  typedef ListGraph Graph;
athos@1181
     9
  typedef Graph::Edge Edge;
athos@1181
    10
  typedef Graph::InEdgeIt InEdgeIt;
athos@1181
    11
  typedef Graph::OutEdgeIt OutEdgeIt;
athos@1181
    12
  typedef Graph::EdgeIt EdgeIt;
athos@1181
    13
  typedef Graph::Node Node;
athos@1181
    14
  typedef Graph::NodeIt NodeIt;
athos@1181
    15
athos@1181
    16
  Graph g;
athos@1181
    17
  
athos@1181
    18
  for (int i = 0; i < 3; i++)
athos@1181
    19
    g.addNode();
athos@1181
    20
  
athos@1181
    21
  for (NodeIt i(g); i!=INVALID; ++i)
athos@1181
    22
    for (NodeIt j(g); j!=INVALID; ++j)
athos@1181
    23
      if (i != j) g.addEdge(i, j);
athos@1181
    24
athos@1181
    25
  std::cout << "Nodes:";
athos@1181
    26
  for (NodeIt i(g); i!=INVALID; ++i)
athos@1181
    27
    std::cout << " " << g.id(i);
athos@1181
    28
  std::cout << std::endl;
athos@1181
    29
athos@1181
    30
  std::cout << "Edges:";
athos@1181
    31
  for (EdgeIt i(g); i!=INVALID; ++i)
athos@1181
    32
    std::cout << " (" << g.id(g.source(i)) << "," << g.id(g.target(i)) << ")";
athos@1181
    33
  std::cout << std::endl;
athos@1181
    34
}