src/work/marci/iterator_bfs_demo.cc
author marci
Tue, 31 Aug 2004 11:26:59 +0000
changeset 775 e46a1f0623a0
parent 642 e812963087f0
child 777 a82713ed19f3
permissions -rw-r--r--
ResGraphWrapper<Graph> is done, so does dimacs.h.
marci@301
     1
// -*- c++ -*-
marci@301
     2
#include <iostream>
marci@301
     3
#include <vector>
marci@301
     4
#include <string>
marci@301
     5
marci@642
     6
#include <sage_graph.h>
alpar@774
     7
#include <hugo/smart_graph.h>
marci@602
     8
#include <bfs_dfs.h>
marci@557
     9
#include <hugo/graph_wrapper.h>
marci@301
    10
marci@301
    11
using namespace hugo;
marci@301
    12
using std::cout; 
marci@301
    13
using std::endl;
marci@301
    14
using std::string;
marci@301
    15
marci@301
    16
template <typename Graph, typename NodeNameMap>
marci@301
    17
class EdgeNameMap {
marci@301
    18
  Graph& graph;
marci@301
    19
  NodeNameMap& node_name_map;
marci@301
    20
public:
marci@301
    21
  EdgeNameMap(Graph& _graph, NodeNameMap& _node_name_map) : 
marci@301
    22
    graph(_graph), node_name_map(_node_name_map) { }
marci@304
    23
  string operator[](typename Graph::Edge e) const { 
marci@301
    24
    return 
marci@304
    25
      (node_name_map[graph.tail(e)]+"->"+node_name_map[graph.head(e)]);
marci@301
    26
  }
marci@301
    27
};
marci@301
    28
marci@301
    29
int main (int, char*[])
marci@301
    30
{
alpar@774
    31
  typedef SmartGraph Graph;
alpar@774
    32
  //typedef SageGraph Graph;
marci@301
    33
marci@301
    34
  typedef Graph::Node Node;
marci@301
    35
  typedef Graph::Edge Edge;
marci@301
    36
 
marci@301
    37
  Graph G;
marci@301
    38
marci@301
    39
  Node s=G.addNode();
marci@301
    40
  Node v1=G.addNode();
marci@301
    41
  Node v2=G.addNode();
marci@301
    42
  Node v3=G.addNode();
marci@301
    43
  Node v4=G.addNode();
marci@301
    44
  Node t=G.addNode();
marci@301
    45
  
marci@301
    46
  Graph::NodeMap<string> node_name(G);
marci@301
    47
  node_name.set(s, "s");
marci@301
    48
  node_name.set(v1, "v1");
marci@301
    49
  node_name.set(v2, "v2");
marci@301
    50
  node_name.set(v3, "v3");
marci@301
    51
  node_name.set(v4, "v4");
marci@301
    52
  node_name.set(t, "t");
marci@301
    53
marci@301
    54
  G.addEdge(s, v1);
marci@301
    55
  G.addEdge(s, v2);
marci@301
    56
  G.addEdge(v1, v2);
marci@301
    57
  G.addEdge(v2, v1);
marci@301
    58
  G.addEdge(v1, v3);
marci@301
    59
  G.addEdge(v3, v2);
marci@301
    60
  G.addEdge(v2, v4);
marci@301
    61
  G.addEdge(v4, v3);
marci@301
    62
  G.addEdge(v3, t);
marci@301
    63
  G.addEdge(v4, t);
marci@301
    64
marci@301
    65
  cout << "    /-->    ------------->            "<< endl;
marci@301
    66
  cout << "   / /-- v1 <-\\      /---- v3-\\      "<< endl;
marci@301
    67
  cout << "  / |          |    /  /->     \\     "<< endl;
marci@301
    68
  cout << " /  |          |   /  |    ^    \\  "<< endl;
marci@301
    69
  cout << "s   |          |  /   |    |     \\->  t "<< endl;
marci@301
    70
  cout << " \\  |          | /    |    |     /->  "<< endl;
marci@301
    71
  cout << "  \\ |       --/ /     |    |    /     "<< endl;
marci@301
    72
  cout << "   \\ \\-> v2 <--/       \\-- v4 -/      "<< endl;
marci@301
    73
  cout << "    \\-->    ------------->         "<< endl;
marci@301
    74
  
marci@301
    75
//   typedef TrivGraphWrapper<const Graph> CGW;
marci@301
    76
//   CGW gw(G);
marci@301
    77
marci@301
    78
//   cout << "bfs and dfs demo on the directed graph" << endl;
marci@301
    79
//   for(CGW::NodeIt n=gw.first<CGW::NodeIt>(); n.valid(); ++n) { 
marci@301
    80
//     cout << n << ": ";
marci@301
    81
//     cout << "out edges: ";
marci@301
    82
//     for(CGW::OutEdgeIt e=gw.first<CGW::OutEdgeIt>(n); e.valid(); ++e) 
marci@301
    83
//       cout << e << " ";
marci@301
    84
//     cout << "in edges: ";
marci@301
    85
//     for(CGW::InEdgeIt e=gw.first<CGW::InEdgeIt>(n); e.valid(); ++e) 
marci@301
    86
//       cout << e << " ";
marci@301
    87
//     cout << endl;
marci@301
    88
//   }
marci@301
    89
marci@301
    90
  {
marci@312
    91
    EdgeNameMap< Graph, Graph::NodeMap<string> > edge_name(G, node_name);
marci@301
    92
    
marci@301
    93
    cout << "bfs and dfs iterator demo on the directed graph" << endl;
alpar@774
    94
    for(Graph::NodeIt n(G); n!=INVALID; ++n) { 
marci@304
    95
      cout << node_name[n] << ": ";
marci@301
    96
      cout << "out edges: ";
alpar@774
    97
      for(Graph::OutEdgeIt e(G, n); e!=INVALID; ++e) 
marci@304
    98
	cout << edge_name[e] << " ";
marci@301
    99
      cout << "in edges: ";
alpar@774
   100
      for(Graph::InEdgeIt e(G, n); e!=INVALID; ++e) 
marci@304
   101
	cout << edge_name[e] << " ";
marci@301
   102
      cout << endl;
marci@301
   103
    }
marci@301
   104
marci@301
   105
    cout << "bfs from s ..." << endl;
marci@360
   106
    BfsIterator< Graph, Graph::NodeMap<bool> > bfs(G);
marci@301
   107
    bfs.pushAndSetReached(s);
marci@301
   108
    while (!bfs.finished()) {
marci@301
   109
      //cout << "edge: ";
alpar@774
   110
      if (Graph::Edge(Graph::OutEdgeIt(bfs))!=INVALID) {
marci@304
   111
	cout << edge_name[bfs] << /*endl*/", " << 
alpar@774
   112
	  node_name[G.tail(bfs)] << 
marci@301
   113
	  (bfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << 
alpar@774
   114
	  node_name[G.head(bfs)] << 
marci@301
   115
	  (bfs.isBNodeNewlyReached() ? ": is newly reached." : 
marci@301
   116
	   ": is not newly reached.");
marci@301
   117
      } else { 
marci@301
   118
	cout << "invalid" << /*endl*/", " << 
marci@304
   119
	  node_name[bfs.aNode()] << 
marci@301
   120
	  (bfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << 
marci@301
   121
	  
marci@301
   122
	  "invalid.";
marci@301
   123
      }
marci@301
   124
      cout << endl;
marci@301
   125
      ++bfs;
marci@301
   126
    }
marci@301
   127
marci@301
   128
    cout << "    /-->    ------------->            "<< endl;
marci@301
   129
    cout << "   / /-- v1 <-\\      /---- v3-\\      "<< endl;
marci@301
   130
    cout << "  / |          |    /  /->     \\     "<< endl;
marci@301
   131
    cout << " /  |          |   /  |    ^    \\  "<< endl;
marci@301
   132
    cout << "s   |          |  /   |    |     \\->  t "<< endl;
marci@301
   133
    cout << " \\  |          | /    |    |     /->  "<< endl;
marci@301
   134
    cout << "  \\ |       --/ /     |    |    /     "<< endl;
marci@301
   135
    cout << "   \\ \\-> v2 <--/       \\-- v4 -/      "<< endl;
marci@301
   136
    cout << "    \\-->    ------------->         "<< endl;
marci@301
   137
marci@301
   138
    cout << "dfs from s ..." << endl;
marci@360
   139
    DfsIterator< Graph, Graph::NodeMap<bool> > dfs(G);
marci@301
   140
    dfs.pushAndSetReached(s);
marci@301
   141
    while (!dfs.finished()) {
marci@301
   142
      ++dfs;
marci@301
   143
      //cout << "edge: ";
alpar@774
   144
      if (Graph::Edge(Graph::OutEdgeIt(dfs))!=INVALID) {
marci@304
   145
	cout << edge_name[dfs] << /*endl*/", " << 
alpar@774
   146
	  node_name[G.tail(dfs)] << 
marci@301
   147
	  (dfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << 
alpar@774
   148
	  node_name[G.head(dfs)] << 
marci@301
   149
	  (dfs.isBNodeNewlyReached() ? ": is newly reached." : 
marci@301
   150
	   ": is not newly reached.");
marci@301
   151
      } else { 
marci@301
   152
	cout << "invalid" << /*endl*/", " << 
marci@304
   153
	  node_name[dfs.aNode()] << 
marci@301
   154
	  (dfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << 
marci@301
   155
	  
marci@301
   156
	  "invalid.";
marci@301
   157
      }
marci@301
   158
      cout << endl;
marci@301
   159
    }
marci@301
   160
  }
marci@301
   161
marci@301
   162
marci@301
   163
  {
marci@312
   164
    typedef RevGraphWrapper<const Graph> GW;
marci@301
   165
    GW gw(G);
marci@301
   166
    
marci@301
   167
    EdgeNameMap< GW, Graph::NodeMap<string> > edge_name(gw, node_name);
marci@301
   168
    
marci@301
   169
    cout << "bfs and dfs iterator demo on the reversed directed graph" << endl;
alpar@774
   170
    for(GW::NodeIt n(gw); n!=INVALID; ++n) { 
marci@317
   171
      cout << node_name[GW::Node(n)] << ": ";
marci@301
   172
      cout << "out edges: ";
alpar@774
   173
      for(GW::OutEdgeIt e(gw, n); e!=INVALID; ++e) 
marci@304
   174
	cout << edge_name[e] << " ";
marci@301
   175
      cout << "in edges: ";
alpar@774
   176
      for(GW::InEdgeIt e(gw, n); e!=INVALID; ++e) 
marci@304
   177
	cout << edge_name[e] << " ";
marci@301
   178
      cout << endl;
marci@301
   179
    }
marci@301
   180
marci@301
   181
    cout << "bfs from t ..." << endl;
marci@360
   182
    BfsIterator< GW, GW::NodeMap<bool> > bfs(gw);
marci@301
   183
    bfs.pushAndSetReached(t);
marci@301
   184
    while (!bfs.finished()) {
marci@301
   185
      //cout << "edge: ";
alpar@774
   186
      if (GW::Edge(GW::OutEdgeIt(bfs))!=INVALID) {
marci@317
   187
	cout << edge_name[GW::OutEdgeIt(bfs)] << /*endl*/", " << 
alpar@774
   188
	  node_name[gw.tail(bfs)] << 
marci@301
   189
	  (bfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << 
alpar@774
   190
	  node_name[gw.head(bfs)] << 
marci@301
   191
	  (bfs.isBNodeNewlyReached() ? ": is newly reached." : 
marci@301
   192
	   ": is not newly reached.");
marci@301
   193
      } else { 
marci@301
   194
	cout << "invalid" << /*endl*/", " << 
marci@304
   195
	  node_name[bfs.aNode()] << 
marci@301
   196
	  (bfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << 
marci@301
   197
	  
marci@301
   198
	  "invalid.";
marci@301
   199
      }
marci@301
   200
      cout << endl;
marci@301
   201
      ++bfs;
marci@301
   202
    }
marci@301
   203
marci@301
   204
    cout << "    /-->    ------------->            "<< endl;
marci@301
   205
    cout << "   / /-- v1 <-\\      /---- v3-\\      "<< endl;
marci@301
   206
    cout << "  / |          |    /  /->     \\     "<< endl;
marci@301
   207
    cout << " /  |          |   /  |    ^    \\  "<< endl;
marci@301
   208
    cout << "s   |          |  /   |    |     \\->  t "<< endl;
marci@301
   209
    cout << " \\  |          | /    |    |     /->  "<< endl;
marci@301
   210
    cout << "  \\ |       --/ /     |    |    /     "<< endl;
marci@301
   211
    cout << "   \\ \\-> v2 <--/       \\-- v4 -/      "<< endl;
marci@301
   212
    cout << "    \\-->    ------------->         "<< endl;
marci@301
   213
    
marci@301
   214
    cout << "dfs from t ..." << endl;
marci@360
   215
    DfsIterator< GW, GW::NodeMap<bool> > dfs(gw);
marci@301
   216
    dfs.pushAndSetReached(t);
marci@301
   217
    while (!dfs.finished()) {
marci@301
   218
      ++dfs;
marci@301
   219
      //cout << "edge: ";
alpar@774
   220
      if (GW::OutEdgeIt(dfs)!=INVALID) {
marci@317
   221
	cout << edge_name[GW::OutEdgeIt(dfs)] << /*endl*/", " << 
alpar@774
   222
	  node_name[gw.tail(dfs)] << 
marci@301
   223
	  (dfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << 
alpar@774
   224
	  node_name[gw.head(dfs)] << 
marci@301
   225
	  (dfs.isBNodeNewlyReached() ? ": is newly reached." : 
marci@301
   226
	   ": is not newly reached.");
marci@301
   227
      } else { 
marci@301
   228
	cout << "invalid" << /*endl*/", " << 
marci@304
   229
	  node_name[dfs.aNode()] << 
marci@301
   230
	  (dfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << 
marci@301
   231
	  
marci@301
   232
	  "invalid.";
marci@301
   233
      }
marci@301
   234
      cout << endl;
marci@301
   235
    }
marci@301
   236
  }
marci@301
   237
alpar@774
   238
//   {
alpar@774
   239
//     typedef UndirGraphWrapper<const Graph> GW;
alpar@774
   240
//     GW gw(G);
alpar@774
   241
    
alpar@774
   242
//     EdgeNameMap< GW, Graph::NodeMap<string> > edge_name(gw, node_name);
alpar@774
   243
    
alpar@774
   244
//     cout << "bfs and dfs iterator demo on the undirected graph" << endl;
alpar@774
   245
//     for(GW::NodeIt n(gw); gw.valid(n); gw.next(n)) { 
alpar@774
   246
//       cout << node_name[GW::Node(n)] << ": ";
alpar@774
   247
//       cout << "out edges: ";
alpar@774
   248
//       for(GW::OutEdgeIt e(gw, n); gw.valid(e); gw.next(e)) 
alpar@774
   249
// 	cout << edge_name[e] << " ";
alpar@774
   250
//       cout << "in edges: ";
alpar@774
   251
//       for(GW::InEdgeIt e(gw, n); gw.valid(e); gw.next(e)) 
alpar@774
   252
// 	cout << edge_name[e] << " ";
alpar@774
   253
//       cout << endl;
alpar@774
   254
//     }
alpar@774
   255
// //     for(GW::EdgeIt e=gw.first<GW::EdgeIt>(); gw.valid(e); gw.next(e)) { 
alpar@774
   256
// //       cout << edge_name.get(e) << " ";
alpar@774
   257
// //     }
alpar@774
   258
// //     cout << endl;
alpar@774
   259
alpar@774
   260
//     cout << "bfs from t ..." << endl;
alpar@774
   261
//     BfsIterator< GW, GW::NodeMap<bool> > bfs(gw);
alpar@774
   262
//     bfs.pushAndSetReached(t);
alpar@774
   263
//     while (!bfs.finished()) {
alpar@774
   264
//       //cout << "edge: ";
alpar@774
   265
//       if (gw.valid(GW::OutEdgeIt(bfs))) {
alpar@774
   266
// 	cout << edge_name[GW::OutEdgeIt(bfs)] << /*endl*/", " << 
alpar@774
   267
// 	  node_name[gw.aNode(bfs)] << 
alpar@774
   268
// 	  (bfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << 
alpar@774
   269
// 	  node_name[gw.bNode(bfs)] << 
alpar@774
   270
// 	  (bfs.isBNodeNewlyReached() ? ": is newly reached." : 
alpar@774
   271
// 	   ": is not newly reached.");
alpar@774
   272
//       } else { 
alpar@774
   273
// 	cout << "invalid" << /*endl*/", " << 
alpar@774
   274
// 	  node_name[bfs.aNode()] << 
alpar@774
   275
// 	  (bfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << 
alpar@774
   276
	  
alpar@774
   277
// 	  "invalid.";
alpar@774
   278
//       }
alpar@774
   279
//       cout << endl;
alpar@774
   280
//       ++bfs;
alpar@774
   281
//     }
alpar@774
   282
alpar@774
   283
//     cout << "    /-->    ------------->            "<< endl;
alpar@774
   284
//     cout << "   / /-- v1 <-\\      /---- v3-\\      "<< endl;
alpar@774
   285
//     cout << "  / |          |    /  /->     \\     "<< endl;
alpar@774
   286
//     cout << " /  |          |   /  |    ^    \\  "<< endl;
alpar@774
   287
//     cout << "s   |          |  /   |    |     \\->  t "<< endl;
alpar@774
   288
//     cout << " \\  |          | /    |    |     /->  "<< endl;
alpar@774
   289
//     cout << "  \\ |       --/ /     |    |    /     "<< endl;
alpar@774
   290
//     cout << "   \\ \\-> v2 <--/       \\-- v4 -/      "<< endl;
alpar@774
   291
//     cout << "    \\-->    ------------->         "<< endl;
alpar@774
   292
    
alpar@774
   293
//     cout << "dfs from t ..." << endl;
alpar@774
   294
//     DfsIterator< GW, GW::NodeMap<bool> > dfs(gw);
alpar@774
   295
//     dfs.pushAndSetReached(t);
alpar@774
   296
//     while (!dfs.finished()) {
alpar@774
   297
//       ++dfs;
alpar@774
   298
//       //cout << "edge: ";
alpar@774
   299
//       if (gw.valid(GW::OutEdgeIt(dfs))) {
alpar@774
   300
// 	cout << edge_name[GW::OutEdgeIt(dfs)] << /*endl*/", " << 
alpar@774
   301
// 	  node_name[gw.aNode(dfs)] << 
alpar@774
   302
// 	  (dfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << 
alpar@774
   303
// 	  node_name[gw.bNode(dfs)] << 
alpar@774
   304
// 	  (dfs.isBNodeNewlyReached() ? ": is newly reached." : 
alpar@774
   305
// 	   ": is not newly reached.");
alpar@774
   306
//       } else { 
alpar@774
   307
// 	cout << "invalid" << /*endl*/", " << 
alpar@774
   308
// 	  node_name[dfs.aNode()] << 
alpar@774
   309
// 	  (dfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << 
alpar@774
   310
	  
alpar@774
   311
// 	  "invalid.";
alpar@774
   312
//       }
alpar@774
   313
//       cout << endl;
alpar@774
   314
//     }
alpar@774
   315
//   }
alpar@774
   316
alpar@774
   317
alpar@774
   318
marci@301
   319
  {
alpar@774
   320
    typedef BidirGraphWrapper<const Graph> GW;
marci@301
   321
    GW gw(G);
marci@301
   322
    
marci@301
   323
    EdgeNameMap< GW, Graph::NodeMap<string> > edge_name(gw, node_name);
marci@301
   324
    
alpar@774
   325
    cout << "bfs and dfs iterator demo on the bidirected graph" << endl;
alpar@774
   326
//     for(GW::EdgeIt e(gw); e!=INVALID; ++e) {
alpar@774
   327
//       cout << node_name[gw.tail(e)] << "->" << node_name[gw.head(e)] << " ";
alpar@774
   328
//     } 
alpar@774
   329
    for(GW::NodeIt n(gw); n!=INVALID; ++n) { 
marci@317
   330
      cout << node_name[GW::Node(n)] << ": ";
marci@301
   331
      cout << "out edges: ";
alpar@774
   332
      for(GW::OutEdgeIt e(gw, n); e!=INVALID; ++e) 
marci@304
   333
	cout << edge_name[e] << " ";
marci@301
   334
      cout << "in edges: ";
alpar@774
   335
      for(GW::InEdgeIt e(gw, n); e!=INVALID; ++e) 
marci@304
   336
	cout << edge_name[e] << " ";
marci@301
   337
      cout << endl;
marci@301
   338
    }
marci@301
   339
//     for(GW::EdgeIt e=gw.first<GW::EdgeIt>(); gw.valid(e); gw.next(e)) { 
marci@301
   340
//       cout << edge_name.get(e) << " ";
marci@301
   341
//     }
marci@301
   342
//     cout << endl;
marci@301
   343
marci@301
   344
    cout << "bfs from t ..." << endl;
marci@360
   345
    BfsIterator< GW, GW::NodeMap<bool> > bfs(gw);
marci@301
   346
    bfs.pushAndSetReached(t);
marci@301
   347
    while (!bfs.finished()) {
marci@301
   348
      //cout << "edge: ";
alpar@774
   349
      if (GW::OutEdgeIt(bfs)!=INVALID) {
marci@304
   350
	cout << edge_name[GW::OutEdgeIt(bfs)] << /*endl*/", " << 
alpar@774
   351
	  node_name[gw.tail(bfs)] << 
marci@301
   352
	  (bfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << 
alpar@774
   353
	  node_name[gw.head(bfs)] << 
marci@301
   354
	  (bfs.isBNodeNewlyReached() ? ": is newly reached." : 
marci@301
   355
	   ": is not newly reached.");
marci@301
   356
      } else { 
marci@301
   357
	cout << "invalid" << /*endl*/", " << 
marci@304
   358
	  node_name[bfs.aNode()] << 
marci@301
   359
	  (bfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << 
marci@301
   360
	  
marci@301
   361
	  "invalid.";
marci@301
   362
      }
marci@301
   363
      cout << endl;
marci@301
   364
      ++bfs;
marci@301
   365
    }
marci@301
   366
marci@301
   367
    cout << "    /-->    ------------->            "<< endl;
marci@301
   368
    cout << "   / /-- v1 <-\\      /---- v3-\\      "<< endl;
marci@301
   369
    cout << "  / |          |    /  /->     \\     "<< endl;
marci@301
   370
    cout << " /  |          |   /  |    ^    \\  "<< endl;
marci@301
   371
    cout << "s   |          |  /   |    |     \\->  t "<< endl;
marci@301
   372
    cout << " \\  |          | /    |    |     /->  "<< endl;
marci@301
   373
    cout << "  \\ |       --/ /     |    |    /     "<< endl;
marci@301
   374
    cout << "   \\ \\-> v2 <--/       \\-- v4 -/      "<< endl;
marci@301
   375
    cout << "    \\-->    ------------->         "<< endl;
marci@301
   376
    
marci@301
   377
    cout << "dfs from t ..." << endl;
marci@360
   378
    DfsIterator< GW, GW::NodeMap<bool> > dfs(gw);
marci@301
   379
    dfs.pushAndSetReached(t);
marci@301
   380
    while (!dfs.finished()) {
marci@301
   381
      ++dfs;
marci@301
   382
      //cout << "edge: ";
alpar@774
   383
      if (GW::OutEdgeIt(dfs)!=INVALID) {
marci@304
   384
	cout << edge_name[GW::OutEdgeIt(dfs)] << /*endl*/", " << 
alpar@774
   385
	  node_name[gw.tail(dfs)] << 
marci@301
   386
	  (dfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << 
alpar@774
   387
	  node_name[gw.head(dfs)] << 
marci@301
   388
	  (dfs.isBNodeNewlyReached() ? ": is newly reached." : 
marci@301
   389
	   ": is not newly reached.");
marci@301
   390
      } else { 
marci@301
   391
	cout << "invalid" << /*endl*/", " << 
marci@304
   392
	  node_name[dfs.aNode()] << 
marci@301
   393
	  (dfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << 
marci@301
   394
	  
marci@301
   395
	  "invalid.";
marci@301
   396
      }
marci@301
   397
      cout << endl;
marci@301
   398
    }
marci@301
   399
  }
marci@301
   400
marci@301
   401
  return 0;
marci@301
   402
}