src/work/marci/iterator_bfs_demo.cc
changeset 986 e997802b855c
parent 921 818510fa3d99
     1.1 --- a/src/work/marci/iterator_bfs_demo.cc	Sat Nov 13 12:24:01 2004 +0000
     1.2 +++ b/src/work/marci/iterator_bfs_demo.cc	Sat Nov 13 12:53:28 2004 +0000
     1.3 @@ -23,7 +23,7 @@
     1.4      graph(_graph), node_name_map(_node_name_map) { }
     1.5    string operator[](typename Graph::Edge e) const { 
     1.6      return 
     1.7 -      (node_name_map[graph.tail(e)]+"->"+node_name_map[graph.head(e)]);
     1.8 +      (node_name_map[graph.source(e)]+"->"+node_name_map[graph.target(e)]);
     1.9    }
    1.10  };
    1.11  
    1.12 @@ -95,14 +95,14 @@
    1.13        //cout << "edge: ";
    1.14        if (Graph::Edge(bfs)!=INVALID) {
    1.15  	cout << edge_name[bfs] << /*endl*/", " << 
    1.16 -	  node_name[G.tail(bfs)] << 
    1.17 +	  node_name[G.source(bfs)] << 
    1.18  	  (bfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << 
    1.19 -	  node_name[G.head(bfs)] << 
    1.20 +	  node_name[G.target(bfs)] << 
    1.21  	  (bfs.isBNodeNewlyReached() ? ": is newly reached." : 
    1.22  	   ": is not newly reached.");
    1.23        } else { 
    1.24  	cout << "invalid" << /*endl*/", " << 
    1.25 -	  node_name[bfs.tail()] << 
    1.26 +	  node_name[bfs.source()] << 
    1.27  	  (bfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << 
    1.28  	  
    1.29  	  "invalid.";
    1.30 @@ -129,14 +129,14 @@
    1.31        //cout << "edge: ";
    1.32        if (Graph::Edge(dfs)!=INVALID) {
    1.33  	cout << edge_name[dfs] << /*endl*/", " << 
    1.34 -	  node_name[G.tail(dfs)] << 
    1.35 +	  node_name[G.source(dfs)] << 
    1.36  	  (dfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << 
    1.37 -	  node_name[G.head(dfs)] << 
    1.38 +	  node_name[G.target(dfs)] << 
    1.39  	  (dfs.isBNodeNewlyReached() ? ": is newly reached." : 
    1.40  	   ": is not newly reached.");
    1.41        } else { 
    1.42  	cout << "invalid" << /*endl*/", " << 
    1.43 -	  node_name[dfs.tail()] << 
    1.44 +	  node_name[dfs.source()] << 
    1.45  	  (dfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << 
    1.46  	  
    1.47  	  "invalid.";
    1.48 @@ -171,14 +171,14 @@
    1.49        //cout << "edge: ";
    1.50        if (GW::Edge(bfs)!=INVALID) {
    1.51  	cout << edge_name[GW::Edge(bfs)] << /*endl*/", " << 
    1.52 -	  node_name[gw.tail(bfs)] << 
    1.53 +	  node_name[gw.source(bfs)] << 
    1.54  	  (bfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << 
    1.55 -	  node_name[gw.head(bfs)] << 
    1.56 +	  node_name[gw.target(bfs)] << 
    1.57  	  (bfs.isBNodeNewlyReached() ? ": is newly reached." : 
    1.58  	   ": is not newly reached.");
    1.59        } else { 
    1.60  	cout << "invalid" << /*endl*/", " << 
    1.61 -	  node_name[bfs.tail()] << 
    1.62 +	  node_name[bfs.source()] << 
    1.63  	  (bfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << 
    1.64  	  
    1.65  	  "invalid.";
    1.66 @@ -205,14 +205,14 @@
    1.67        //cout << "edge: ";
    1.68        if (GW::Edge(dfs)!=INVALID) {
    1.69  	cout << edge_name[GW::Edge(dfs)] << /*endl*/", " << 
    1.70 -	  node_name[gw.tail(dfs)] << 
    1.71 +	  node_name[gw.source(dfs)] << 
    1.72  	  (dfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << 
    1.73 -	  node_name[gw.head(dfs)] << 
    1.74 +	  node_name[gw.target(dfs)] << 
    1.75  	  (dfs.isBNodeNewlyReached() ? ": is newly reached." : 
    1.76  	   ": is not newly reached.");
    1.77        } else { 
    1.78  	cout << "invalid" << /*endl*/", " << 
    1.79 -	  node_name[dfs.tail()] << 
    1.80 +	  node_name[dfs.source()] << 
    1.81  	  (dfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << 
    1.82  	  
    1.83  	  "invalid.";
    1.84 @@ -310,7 +310,7 @@
    1.85      
    1.86      cout << "bfs and dfs iterator demo on the bidirected graph" << endl;
    1.87  //     for(GW::EdgeIt e(gw); e!=INVALID; ++e) {
    1.88 -//       cout << node_name[gw.tail(e)] << "->" << node_name[gw.head(e)] << " ";
    1.89 +//       cout << node_name[gw.source(e)] << "->" << node_name[gw.target(e)] << " ";
    1.90  //     } 
    1.91      for(GW::NodeIt n(gw); n!=INVALID; ++n) { 
    1.92        cout << node_name[GW::Node(n)] << ": ";
    1.93 @@ -334,14 +334,14 @@
    1.94        //cout << "edge: ";
    1.95        if (GW::Edge(bfs)!=INVALID) {
    1.96  	cout << edge_name[GW::Edge(bfs)] << /*endl*/", " << 
    1.97 -	  node_name[gw.tail(bfs)] << 
    1.98 +	  node_name[gw.source(bfs)] << 
    1.99  	  (bfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << 
   1.100 -	  node_name[gw.head(bfs)] << 
   1.101 +	  node_name[gw.target(bfs)] << 
   1.102  	  (bfs.isBNodeNewlyReached() ? ": is newly reached." : 
   1.103  	   ": is not newly reached.");
   1.104        } else { 
   1.105  	cout << "invalid" << /*endl*/", " << 
   1.106 -	  node_name[bfs.tail()] << 
   1.107 +	  node_name[bfs.source()] << 
   1.108  	  (bfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << 
   1.109  	  
   1.110  	  "invalid.";
   1.111 @@ -368,14 +368,14 @@
   1.112        //cout << "edge: ";
   1.113        if (GW::Edge(dfs)!=INVALID) {
   1.114  	cout << edge_name[GW::Edge(dfs)] << /*endl*/", " << 
   1.115 -	  node_name[gw.tail(dfs)] << 
   1.116 +	  node_name[gw.source(dfs)] << 
   1.117  	  (dfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << 
   1.118 -	  node_name[gw.head(dfs)] << 
   1.119 +	  node_name[gw.target(dfs)] << 
   1.120  	  (dfs.isBNodeNewlyReached() ? ": is newly reached." : 
   1.121  	   ": is not newly reached.");
   1.122        } else { 
   1.123  	cout << "invalid" << /*endl*/", " << 
   1.124 -	  node_name[dfs.tail()] << 
   1.125 +	  node_name[dfs.source()] << 
   1.126  	  (dfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << 
   1.127  	  
   1.128  	  "invalid.";