demo/helloworld.cc
author klao
Tue, 21 Jun 2005 14:57:17 +0000
changeset 1507 14ca1624e8e8
parent 1181 848b6006941d
child 1511 d6b95a59da26
permissions -rw-r--r--
Get CPLEX location (include and libdir) from the environment.
(On lemon.cs.elte.hu use "cplex_env" command to set the environment
appropriately.)
     1 #include <iostream>
     2 #include <lemon/list_graph.h>
     3 
     4 using namespace lemon;
     5 
     6 int main()
     7 {
     8   typedef ListGraph Graph;
     9   typedef Graph::Edge Edge;
    10   typedef Graph::InEdgeIt InEdgeIt;
    11   typedef Graph::OutEdgeIt OutEdgeIt;
    12   typedef Graph::EdgeIt EdgeIt;
    13   typedef Graph::Node Node;
    14   typedef Graph::NodeIt NodeIt;
    15 
    16   Graph g;
    17   
    18   for (int i = 0; i < 3; i++)
    19     g.addNode();
    20   
    21   for (NodeIt i(g); i!=INVALID; ++i)
    22     for (NodeIt j(g); j!=INVALID; ++j)
    23       if (i != j) g.addEdge(i, j);
    24 
    25   std::cout << "Nodes:";
    26   for (NodeIt i(g); i!=INVALID; ++i)
    27     std::cout << " " << g.id(i);
    28   std::cout << std::endl;
    29 
    30   std::cout << "Edges:";
    31   for (EdgeIt i(g); i!=INVALID; ++i)
    32     std::cout << " (" << g.id(g.source(i)) << "," << g.id(g.target(i)) << ")";
    33   std::cout << std::endl;
    34 }