Line | |
---|
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 << "Hello World!" << std::endl; |
---|
21 | std::cout << std::endl; |
---|
22 | std::cout << "This is library LEMON here! We have a graph!" << std::endl; |
---|
23 | std::cout << std::endl; |
---|
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 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.