COIN-OR::LEMON - Graph Library

Ticket #392: bug.cpp

File bug.cpp, 591 bytes (added by Gabor Retvari, 14 years ago)
Line 
1#include <lemon/list_graph.h>
2#include <lemon/dfs.h>
3
4using namespace lemon;
5using namespace std;
6
7typedef ListDigraph Graph;
8typedef ListDigraph::Arc Arc;
9typedef ListDigraph::Node Node;
10
11//# creation of graphs
12int 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}