author | athos |
Fri, 01 Jul 2005 16:10:46 +0000 | |
changeset 1528 | 1aa71600000c |
parent 1520 | c2c76e4598f6 |
child 1530 | d99c3c84f797 |
permissions | -rw-r--r-- |
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 |
|
athos@1526 | 20 |
std::cout << "Hello World!" << std::endl; |
athos@1526 | 21 |
std::cout << std::endl; |
athos@1526 | 22 |
std::cout << "This is library LEMON here! We have a graph!" << std::endl; |
athos@1526 | 23 |
std::cout << std::endl; |
athos@1526 | 24 |
|
klao@1520 | 25 |
std::cout << "Nodes:"; |
klao@1520 | 26 |
for (NodeIt i(g); i!=INVALID; ++i) |
klao@1520 | 27 |
std::cout << " " << g.id(i); |
klao@1520 | 28 |
std::cout << std::endl; |
klao@1520 | 29 |
|
klao@1520 | 30 |
std::cout << "Edges:"; |
klao@1520 | 31 |
for (EdgeIt i(g); i!=INVALID; ++i) |
klao@1520 | 32 |
std::cout << " (" << g.id(g.source(i)) << "," << g.id(g.target(i)) << ")"; |
klao@1520 | 33 |
std::cout << std::endl; |
klao@1520 | 34 |
} |