1.1 --- a/src/work/marci/iterator_bfs_demo.cc Mon Apr 05 16:52:46 2004 +0000
1.2 +++ b/src/work/marci/iterator_bfs_demo.cc Mon Apr 05 17:10:25 2004 +0000
1.3 @@ -20,9 +20,9 @@
1.4 public:
1.5 EdgeNameMap(Graph& _graph, NodeNameMap& _node_name_map) :
1.6 graph(_graph), node_name_map(_node_name_map) { }
1.7 - string get(typename Graph::Edge e) const {
1.8 + string operator[](typename Graph::Edge e) const {
1.9 return
1.10 - (node_name_map.get(graph.tail(e))+"->"+node_name_map.get(graph.head(e)));
1.11 + (node_name_map[graph.tail(e)]+"->"+node_name_map[graph.head(e)]);
1.12 }
1.13 };
1.14
1.15 @@ -95,13 +95,13 @@
1.16
1.17 cout << "bfs and dfs iterator demo on the directed graph" << endl;
1.18 for(GW::NodeIt n(gw); gw.valid(n); gw.next(n)) {
1.19 - cout << node_name.get(n) << ": ";
1.20 + cout << node_name[n] << ": ";
1.21 cout << "out edges: ";
1.22 for(GW::OutEdgeIt e(gw, n); gw.valid(e); gw.next(e))
1.23 - cout << edge_name.get(e) << " ";
1.24 + cout << edge_name[e] << " ";
1.25 cout << "in edges: ";
1.26 for(GW::InEdgeIt e(gw, n); gw.valid(e); gw.next(e))
1.27 - cout << edge_name.get(e) << " ";
1.28 + cout << edge_name[e] << " ";
1.29 cout << endl;
1.30 }
1.31
1.32 @@ -111,15 +111,15 @@
1.33 while (!bfs.finished()) {
1.34 //cout << "edge: ";
1.35 if (gw.valid(bfs)) {
1.36 - cout << edge_name.get(bfs) << /*endl*/", " <<
1.37 - node_name.get(gw.aNode(bfs)) <<
1.38 + cout << edge_name[bfs] << /*endl*/", " <<
1.39 + node_name[gw.aNode(bfs)] <<
1.40 (bfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") <<
1.41 - node_name.get(gw.bNode(bfs)) <<
1.42 + node_name[gw.bNode(bfs)] <<
1.43 (bfs.isBNodeNewlyReached() ? ": is newly reached." :
1.44 ": is not newly reached.");
1.45 } else {
1.46 cout << "invalid" << /*endl*/", " <<
1.47 - node_name.get(bfs.aNode()) <<
1.48 + node_name[bfs.aNode()] <<
1.49 (bfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") <<
1.50
1.51 "invalid.";
1.52 @@ -145,15 +145,15 @@
1.53 ++dfs;
1.54 //cout << "edge: ";
1.55 if (gw.valid(dfs)) {
1.56 - cout << edge_name.get(dfs) << /*endl*/", " <<
1.57 - node_name.get(gw.aNode(dfs)) <<
1.58 + cout << edge_name[dfs] << /*endl*/", " <<
1.59 + node_name[gw.aNode(dfs)] <<
1.60 (dfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") <<
1.61 - node_name.get(gw.bNode(dfs)) <<
1.62 + node_name[gw.bNode(dfs)] <<
1.63 (dfs.isBNodeNewlyReached() ? ": is newly reached." :
1.64 ": is not newly reached.");
1.65 } else {
1.66 cout << "invalid" << /*endl*/", " <<
1.67 - node_name.get(dfs.aNode()) <<
1.68 + node_name[dfs.aNode()] <<
1.69 (dfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") <<
1.70
1.71 "invalid.";
1.72 @@ -171,13 +171,13 @@
1.73
1.74 cout << "bfs and dfs iterator demo on the reversed directed graph" << endl;
1.75 for(GW::NodeIt n(gw); gw.valid(n); gw.next(n)) {
1.76 - cout << node_name.get(n) << ": ";
1.77 + cout << node_name[n] << ": ";
1.78 cout << "out edges: ";
1.79 for(GW::OutEdgeIt e(gw, n); gw.valid(e); gw.next(e))
1.80 - cout << edge_name.get(e) << " ";
1.81 + cout << edge_name[e] << " ";
1.82 cout << "in edges: ";
1.83 for(GW::InEdgeIt e(gw, n); gw.valid(e); gw.next(e))
1.84 - cout << edge_name.get(e) << " ";
1.85 + cout << edge_name[e] << " ";
1.86 cout << endl;
1.87 }
1.88
1.89 @@ -187,15 +187,15 @@
1.90 while (!bfs.finished()) {
1.91 //cout << "edge: ";
1.92 if (gw.valid(bfs)) {
1.93 - cout << edge_name.get(bfs) << /*endl*/", " <<
1.94 - node_name.get(gw.aNode(bfs)) <<
1.95 + cout << edge_name[bfs] << /*endl*/", " <<
1.96 + node_name[gw.aNode(bfs)] <<
1.97 (bfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") <<
1.98 - node_name.get(gw.bNode(bfs)) <<
1.99 + node_name[gw.bNode(bfs)] <<
1.100 (bfs.isBNodeNewlyReached() ? ": is newly reached." :
1.101 ": is not newly reached.");
1.102 } else {
1.103 cout << "invalid" << /*endl*/", " <<
1.104 - node_name.get(bfs.aNode()) <<
1.105 + node_name[bfs.aNode()] <<
1.106 (bfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") <<
1.107
1.108 "invalid.";
1.109 @@ -221,15 +221,15 @@
1.110 ++dfs;
1.111 //cout << "edge: ";
1.112 if (gw.valid(dfs)) {
1.113 - cout << edge_name.get(dfs) << /*endl*/", " <<
1.114 - node_name.get(gw.aNode(dfs)) <<
1.115 + cout << edge_name[dfs] << /*endl*/", " <<
1.116 + node_name[gw.aNode(dfs)] <<
1.117 (dfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") <<
1.118 - node_name.get(gw.bNode(dfs)) <<
1.119 + node_name[gw.bNode(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.get(dfs.aNode()) <<
1.125 + node_name[dfs.aNode()] <<
1.126 (dfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") <<
1.127
1.128 "invalid.";
1.129 @@ -247,13 +247,13 @@
1.130
1.131 cout << "bfs and dfs iterator demo on the undirected graph" << endl;
1.132 for(GW::NodeIt n(gw); gw.valid(n); gw.next(n)) {
1.133 - cout << node_name.get(n) << ": ";
1.134 + cout << node_name[n] << ": ";
1.135 cout << "out edges: ";
1.136 for(GW::OutEdgeIt e(gw, n); gw.valid(e); gw.next(e))
1.137 - cout << edge_name.get(e) << " ";
1.138 + cout << edge_name[e] << " ";
1.139 cout << "in edges: ";
1.140 for(GW::InEdgeIt e(gw, n); gw.valid(e); gw.next(e))
1.141 - cout << edge_name.get(e) << " ";
1.142 + cout << edge_name[e] << " ";
1.143 cout << endl;
1.144 }
1.145 // for(GW::EdgeIt e=gw.first<GW::EdgeIt>(); gw.valid(e); gw.next(e)) {
1.146 @@ -267,15 +267,15 @@
1.147 while (!bfs.finished()) {
1.148 //cout << "edge: ";
1.149 if (gw.valid(GW::OutEdgeIt(bfs))) {
1.150 - cout << edge_name.get(GW::OutEdgeIt(bfs)) << /*endl*/", " <<
1.151 - node_name.get(gw.aNode(bfs)) <<
1.152 + cout << edge_name[GW::OutEdgeIt(bfs)] << /*endl*/", " <<
1.153 + node_name[gw.aNode(bfs)] <<
1.154 (bfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") <<
1.155 - node_name.get(gw.bNode(bfs)) <<
1.156 + node_name[gw.bNode(bfs)] <<
1.157 (bfs.isBNodeNewlyReached() ? ": is newly reached." :
1.158 ": is not newly reached.");
1.159 } else {
1.160 cout << "invalid" << /*endl*/", " <<
1.161 - node_name.get(bfs.aNode()) <<
1.162 + node_name[bfs.aNode()] <<
1.163 (bfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") <<
1.164
1.165 "invalid.";
1.166 @@ -301,15 +301,15 @@
1.167 ++dfs;
1.168 //cout << "edge: ";
1.169 if (gw.valid(GW::OutEdgeIt(dfs))) {
1.170 - cout << edge_name.get(GW::OutEdgeIt(dfs)) << /*endl*/", " <<
1.171 - node_name.get(gw.aNode(dfs)) <<
1.172 + cout << edge_name[GW::OutEdgeIt(dfs)] << /*endl*/", " <<
1.173 + node_name[gw.aNode(dfs)] <<
1.174 (dfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") <<
1.175 - node_name.get(gw.bNode(dfs)) <<
1.176 + node_name[gw.bNode(dfs)] <<
1.177 (dfs.isBNodeNewlyReached() ? ": is newly reached." :
1.178 ": is not newly reached.");
1.179 } else {
1.180 cout << "invalid" << /*endl*/", " <<
1.181 - node_name.get(dfs.aNode()) <<
1.182 + node_name[dfs.aNode()] <<
1.183 (dfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") <<
1.184
1.185 "invalid.";