demo/helloworld.cc
changeset 1435 8e85e6bbefdf
parent 1181 848b6006941d
child 1511 d6b95a59da26
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/demo/helloworld.cc	Mon May 23 04:48:14 2005 +0000
     1.3 @@ -0,0 +1,34 @@
     1.4 +#include <iostream>
     1.5 +#include <lemon/list_graph.h>
     1.6 +
     1.7 +using namespace lemon;
     1.8 +
     1.9 +int main()
    1.10 +{
    1.11 +  typedef ListGraph Graph;
    1.12 +  typedef Graph::Edge Edge;
    1.13 +  typedef Graph::InEdgeIt InEdgeIt;
    1.14 +  typedef Graph::OutEdgeIt OutEdgeIt;
    1.15 +  typedef Graph::EdgeIt EdgeIt;
    1.16 +  typedef Graph::Node Node;
    1.17 +  typedef Graph::NodeIt NodeIt;
    1.18 +
    1.19 +  Graph g;
    1.20 +  
    1.21 +  for (int i = 0; i < 3; i++)
    1.22 +    g.addNode();
    1.23 +  
    1.24 +  for (NodeIt i(g); i!=INVALID; ++i)
    1.25 +    for (NodeIt j(g); j!=INVALID; ++j)
    1.26 +      if (i != j) g.addEdge(i, j);
    1.27 +
    1.28 +  std::cout << "Nodes:";
    1.29 +  for (NodeIt i(g); i!=INVALID; ++i)
    1.30 +    std::cout << " " << g.id(i);
    1.31 +  std::cout << std::endl;
    1.32 +
    1.33 +  std::cout << "Edges:";
    1.34 +  for (EdgeIt i(g); i!=INVALID; ++i)
    1.35 +    std::cout << " (" << g.id(g.source(i)) << "," << g.id(g.target(i)) << ")";
    1.36 +  std::cout << std::endl;
    1.37 +}