1 | #include <lemon/list_graph.h> |
---|
2 | #include <lemon/dfs.h> |
---|
3 | |
---|
4 | using namespace lemon; |
---|
5 | using namespace std; |
---|
6 | |
---|
7 | typedef ListDigraph Graph; |
---|
8 | typedef ListDigraph::Arc Arc; |
---|
9 | typedef ListDigraph::Node Node; |
---|
10 | |
---|
11 | //# creation of graphs |
---|
12 | int main(){ |
---|
13 | ListDigraph g; |
---|
14 | Node nodes[2]; |
---|
15 | |
---|
16 | for(int i = 0; i < 2; ++i) |
---|
17 | nodes[i] = g.addNode(); |
---|
18 | |
---|
19 | g.addArc(nodes[0], nodes[1]); |
---|
20 | |
---|
21 | Dfs<Graph> d(g); |
---|
22 | bool ret = d.run(nodes[0], nodes[1]); |
---|
23 | |
---|
24 | if(ret) |
---|
25 | cout << "OK" << endl; |
---|
26 | else |
---|
27 | cout << "not OK" << endl; |
---|
28 | |
---|
29 | if(d.reached(nodes[1])) |
---|
30 | cout << "OK" << endl; |
---|
31 | else |
---|
32 | cout << "not OK" << endl; |
---|
33 | |
---|
34 | return 0; |
---|
35 | } |
---|