demo/hello_lemon.cc
changeset 1520 c2c76e4598f6
child 1526 8c14aa8f27a2
equal deleted inserted replaced
-1:000000000000 0:a4c1e0597261
       
     1 #include <iostream>
       
     2 #include <lemon/list_graph.h>
       
     3 
       
     4 int main()
       
     5 {
       
     6   typedef lemon::ListGraph Graph;
       
     7   typedef Graph::EdgeIt EdgeIt;
       
     8   typedef Graph::NodeIt NodeIt;
       
     9   using lemon::INVALID;
       
    10 
       
    11   Graph g;
       
    12   
       
    13   for (int i = 0; i < 3; i++)
       
    14     g.addNode();
       
    15   
       
    16   for (NodeIt i(g); i!=INVALID; ++i)
       
    17     for (NodeIt j(g); j!=INVALID; ++j)
       
    18       if (i != j) g.addEdge(i, j);
       
    19 
       
    20   std::cout << "Nodes:";
       
    21   for (NodeIt i(g); i!=INVALID; ++i)
       
    22     std::cout << " " << g.id(i);
       
    23   std::cout << std::endl;
       
    24 
       
    25   std::cout << "Edges:";
       
    26   for (EdgeIt i(g); i!=INVALID; ++i)
       
    27     std::cout << " (" << g.id(g.source(i)) << "," << g.id(g.target(i)) << ")";
       
    28   std::cout << std::endl;
       
    29 }