# HG changeset patch # User marci # Date 1082810681 0 # Node ID 770cc1f4861f2d56227d45d1a1b866f05933bc49 # Parent 8aca0af3f30b8eb227f144af7346249ddb87d005 modifications for better compatibility with gcc 3.4.0 diff -r 8aca0af3f30b -r 770cc1f4861f src/include/invalid.h --- a/src/include/invalid.h Fri Apr 23 21:26:32 2004 +0000 +++ b/src/include/invalid.h Sat Apr 24 12:44:41 2004 +0000 @@ -27,7 +27,7 @@ //const Invalid &INVALID = *(Invalid *)0; const Invalid INVALID = Invalid(); -}; +} //namespace hugo #endif diff -r 8aca0af3f30b -r 770cc1f4861f src/include/maps.h --- a/src/include/maps.h Fri Apr 23 21:26:32 2004 +0000 +++ b/src/include/maps.h Sat Apr 24 12:44:41 2004 +0000 @@ -92,13 +92,16 @@ StdMap(const parent &m, const T& _v) : parent(m), v(_v) {} template - StdMap(const StdMap &m, const T &_v) { FIXME; } + StdMap(const StdMap &m, const T &_v) { + //FIXME; + } ReferenceType operator[](const Key &k) { return insert(PairType(k,v)).first -> second; } ConstReferenceType operator[](const Key &k) const { - typename parent::iterator i = lower_bound(__k); +//marci jav typename parent::iterator i = lower_bound(__k); + typename parent::iterator i = lower_bound(k); if (i == end() || key_comp()(k, (*i).first)) return v; return (*i).second; diff -r 8aca0af3f30b -r 770cc1f4861f src/work/jacint/preflow.h --- a/src/work/jacint/preflow.h Fri Apr 23 21:26:32 2004 +0000 +++ b/src/work/jacint/preflow.h Sat Apr 24 12:44:41 2004 +0000 @@ -52,8 +52,8 @@ namespace hugo { template , - typename FlowMap=typename Graph::EdgeMap > + typename CapMap=typename Graph::template EdgeMap, + typename FlowMap=typename Graph::template EdgeMap > class Preflow { typedef typename Graph::Node Node; @@ -99,16 +99,16 @@ int k=n-2; //bound on the highest level under n containing a node int b=k; //bound on the highest level under n of an active node - typename Graph::NodeMap level(G,n); - typename Graph::NodeMap excess(G); + typename Graph::template NodeMap level(G,n); + typename Graph::template NodeMap excess(G); std::vector active(n-1,INVALID); - typename Graph::NodeMap next(G,INVALID); + typename Graph::template NodeMap next(G,INVALID); //Stack of the active nodes in level i < n. //We use it in both phases. - typename Graph::NodeMap left(G,INVALID); - typename Graph::NodeMap right(G,INVALID); + typename Graph::template NodeMap left(G,INVALID); + typename Graph::template NodeMap right(G,INVALID); std::vector level_list(n,INVALID); /* List of the nodes in level i class NodeMap; template class EdgeMap; - private: +// private: template friend class NodeMap; template friend class EdgeMap; @@ -75,6 +75,7 @@ void update(T a) { container.resize(G.edge_id, a); } }; + private: int node_id; int edge_id; int _node_num; diff -r 8aca0af3f30b -r 770cc1f4861f src/work/makefile --- a/src/work/makefile Fri Apr 23 21:26:32 2004 +0000 +++ b/src/work/makefile Sat Apr 24 12:44:41 2004 +0000 @@ -1,10 +1,11 @@ INCLUDEDIRS ?= -I../include -I. -I./{marci,jacint,alpar,klao,akos} -CXXFLAGS = -g -O -Wall $(INCLUDEDIRS) -ansi -pedantic +CXXFLAGS = -g -O2 -W -Wall $(INCLUDEDIRS) -ansi -pedantic BINARIES ?= bin_heap_demo # Hat, ez elismerem, hogy nagyon ronda, de mukodik minden altalam # ismert rendszeren :-) (Misi) +#CXX := $(shell type -p g++-3.4 || type -p g++-3.3 || type -p g++-3.2 || type -p g++-3.0 || type -p g++-3 || echo g++) CXX := $(shell type -p g++-3.3 || type -p g++-3.2 || type -p g++-3.0 || type -p g++-3 || echo g++) CC := $(CXX) diff -r 8aca0af3f30b -r 770cc1f4861f src/work/marci/bfs_iterator.h --- a/src/work/marci/bfs_iterator.h Fri Apr 23 21:26:32 2004 +0000 +++ b/src/work/marci/bfs_iterator.h Sat Apr 24 12:44:41 2004 +0000 @@ -146,7 +146,7 @@ bool isBNodeNewlyReached() const { return b_node_newly_reached; } bool isANodeExamined() const { return !(graph->valid(actual_edge)); } Node aNode() const { return actual_node; /*FIXME*/} - Node bNode() const { return G.bNode(actual_edge); } + Node bNode() const { return graph->bNode(actual_edge); } const ReachedMap& getReachedMap() const { return reached; } const std::stack& getDfsStack() const { return dfs_stack; } }; diff -r 8aca0af3f30b -r 770cc1f4861f src/work/marci/bfsit_vs_byhand.cc --- a/src/work/marci/bfsit_vs_byhand.cc Fri Apr 23 21:26:32 2004 +0000 +++ b/src/work/marci/bfsit_vs_byhand.cc Sat Apr 24 12:44:41 2004 +0000 @@ -3,7 +3,7 @@ #include #include -#include +//#include #include #include #include diff -r 8aca0af3f30b -r 770cc1f4861f src/work/marci/bipartite_graph_wrapper_test.cc --- a/src/work/marci/bipartite_graph_wrapper_test.cc Fri Apr 23 21:26:32 2004 +0000 +++ b/src/work/marci/bipartite_graph_wrapper_test.cc Sat Apr 24 12:44:41 2004 +0000 @@ -4,7 +4,7 @@ #include #include -#include +//#include //#include #include #include diff -r 8aca0af3f30b -r 770cc1f4861f src/work/marci/edmonds_karp.h --- a/src/work/marci/edmonds_karp.h Fri Apr 23 21:26:32 2004 +0000 +++ b/src/work/marci/edmonds_karp.h Sat Apr 24 12:44:41 2004 +0000 @@ -275,13 +275,14 @@ ResGW res_graph(*g, *capacity, *flow); bool _augment=false; - BfsIterator< ResGW, typename ResGW::NodeMap > bfs(res_graph); + BfsIterator< ResGW, typename ResGW::template NodeMap > + bfs(res_graph); bfs.pushAndSetReached(s); - typename ResGW::NodeMap pred(res_graph); + typename ResGW::template NodeMap pred(res_graph); pred.set(s, INVALID); - typename ResGW::NodeMap free(res_graph); + typename ResGW::template NodeMap free(res_graph); //searching for augmenting path while ( !bfs.finished() ) { @@ -318,7 +319,7 @@ class DistanceMap { protected: const MapGraphWrapper* g; - typename MapGraphWrapper::NodeMap dist; + typename MapGraphWrapper::template NodeMap dist; public: DistanceMap(MapGraphWrapper& _g) : g(&_g), dist(*g, g->nodeNum()) { } void set(const typename MapGraphWrapper::Node& n, int a) { dist[n]=a; } @@ -339,7 +340,8 @@ ResGW res_graph(*g, *capacity, *flow); - BfsIterator< ResGW, typename ResGW::NodeMap > bfs(res_graph); + BfsIterator< ResGW, typename ResGW::template NodeMap > + bfs(res_graph); bfs.pushAndSetReached(s); //typename ResGW::NodeMap dist(res_graph); //filled up with 0's @@ -357,7 +359,8 @@ typedef SubGraphWrapper, DistanceMap > FilterResGW; FilterResGW filter_res_graph(res_graph, true_map, dist); - typename ResGW::NodeMap res_graph_to_F(res_graph); + typename ResGW::template NodeMap + res_graph_to_F(res_graph); { typename ResGW::NodeIt n; for(res_graph.first(n); res_graph.valid(n); res_graph.next(n)) { @@ -367,8 +370,8 @@ typename MG::Node sF=res_graph_to_F[s]; typename MG::Node tF=res_graph_to_F[t]; - typename MG::EdgeMap original_edge(F); - typename MG::EdgeMap residual_capacity(F); + typename MG::template EdgeMap original_edge(F); + typename MG::template EdgeMap residual_capacity(F); //Making F to the graph containing the edges of the residual graph //which are in some shortest paths @@ -391,12 +394,12 @@ __augment=false; //computing blocking flow with dfs - DfsIterator< MG, typename MG::NodeMap > dfs(F); - typename MG::NodeMap pred(F); + DfsIterator< MG, typename MG::template NodeMap > dfs(F); + typename MG::template NodeMap pred(F); pred.set(sF, INVALID); //invalid iterators for sources - typename MG::NodeMap free(F); + typename MG::template NodeMap free(F); dfs.pushAndSetReached(sF); while (!dfs.finished()) { @@ -449,14 +452,17 @@ ResGW res_graph(*g, *capacity, *flow); //bfs for distances on the residual graph - BfsIterator< ResGW, typename ResGW::NodeMap > bfs(res_graph); + BfsIterator< ResGW, typename ResGW::template NodeMap > + bfs(res_graph); bfs.pushAndSetReached(s); - typename ResGW::NodeMap dist(res_graph); //filled up with 0's + typename ResGW::template NodeMap + dist(res_graph); //filled up with 0's //F will contain the physical copy of the residual graph //with the set of edges which are on shortest paths MG F; - typename ResGW::NodeMap res_graph_to_F(res_graph); + typename ResGW::template NodeMap + res_graph_to_F(res_graph); { typename ResGW::NodeIt n; for(res_graph.first(n); res_graph.valid(n); res_graph.next(n)) { @@ -466,8 +472,8 @@ typename MG::Node sF=res_graph_to_F[s]; typename MG::Node tF=res_graph_to_F[t]; - typename MG::EdgeMap original_edge(F); - typename MG::EdgeMap residual_capacity(F); + typename MG::template EdgeMap original_edge(F); + typename MG::template EdgeMap residual_capacity(F); while ( !bfs.finished() ) { ResGWOutEdgeIt e=bfs; @@ -497,12 +503,12 @@ while (__augment) { __augment=false; //computing blocking flow with dfs - DfsIterator< MG, typename MG::NodeMap > dfs(F); - typename MG::NodeMap pred(F); + DfsIterator< MG, typename MG::template NodeMap > dfs(F); + typename MG::template NodeMap pred(F); pred.set(sF, INVALID); //invalid iterators for sources - typename MG::NodeMap free(F); + typename MG::template NodeMap free(F); dfs.pushAndSetReached(sF); while (!dfs.finished()) { @@ -553,7 +559,8 @@ ResGW res_graph(*g, *capacity, *flow); - BfsIterator< ResGW, typename ResGW::NodeMap > bfs(res_graph); + BfsIterator< ResGW, typename ResGW::template NodeMap > + bfs(res_graph); bfs.pushAndSetReached(s); DistanceMap dist(res_graph); @@ -573,7 +580,7 @@ //Subgraph, which is able to delete edges which are already //met by the dfs - typename FilterResGW::NodeMap + typename FilterResGW::template NodeMap first_out_edges(filter_res_graph); typename FilterResGW::NodeIt v; for(filter_res_graph.first(v); filter_res_graph.valid(v); @@ -584,7 +591,7 @@ first_out_edges.set(v, e); } typedef ErasingFirstGraphWrapper > ErasingResGW; + template NodeMap > ErasingResGW; ErasingResGW erasing_res_graph(filter_res_graph, first_out_edges); bool __augment=true; @@ -593,14 +600,17 @@ __augment=false; //computing blocking flow with dfs - DfsIterator< ErasingResGW, typename ErasingResGW::NodeMap > + DfsIterator< ErasingResGW, + typename ErasingResGW::template NodeMap > dfs(erasing_res_graph); - typename ErasingResGW::NodeMap - pred(erasing_res_graph); + typename ErasingResGW:: + template NodeMap + pred(erasing_res_graph); pred.set(s, INVALID); //invalid iterators for sources - typename ErasingResGW::NodeMap free1(erasing_res_graph); + typename ErasingResGW::template NodeMap + free1(erasing_res_graph); dfs.pushAndSetReached( typename ErasingResGW::Node( diff -r 8aca0af3f30b -r 770cc1f4861f src/work/marci/edmonds_karp_demo.cc --- a/src/work/marci/edmonds_karp_demo.cc Fri Apr 23 21:26:32 2004 +0000 +++ b/src/work/marci/edmonds_karp_demo.cc Sat Apr 24 12:44:41 2004 +0000 @@ -3,7 +3,7 @@ #include #include -#include +//#include #include #include #include diff -r 8aca0af3f30b -r 770cc1f4861f src/work/marci/graph_wrapper.h --- a/src/work/marci/graph_wrapper.h Fri Apr 23 21:26:32 2004 +0000 +++ b/src/work/marci/graph_wrapper.h Sat Apr 24 12:44:41 2004 +0000 @@ -183,20 +183,18 @@ void clear() const { graph->clear(); } - template class NodeMap : public Graph::NodeMap { + template class NodeMap : public Graph::template NodeMap { + typedef typename Graph::template NodeMap Parent; public: - NodeMap(const GraphWrapper& _G) : - Graph::NodeMap(*(_G.graph)) { } - NodeMap(const GraphWrapper& _G, T a) : - Graph::NodeMap(*(_G.graph), a) { } + NodeMap(const GraphWrapper& _G) : Parent(*(_G.graph)) { } + NodeMap(const GraphWrapper& _G, T a) : Parent(*(_G.graph), a) { } }; - template class EdgeMap : public Graph::EdgeMap { + template class EdgeMap : public Graph::template EdgeMap { + typedef typename Graph::template EdgeMap Parent; public: - EdgeMap(const GraphWrapper& _G) : - Graph::EdgeMap(*(_G.graph)) { } - EdgeMap(const GraphWrapper& _G, T a) : - Graph::EdgeMap(*(_G.graph), a) { } + EdgeMap(const GraphWrapper& _G) : Parent(*(_G.graph)) { } + EdgeMap(const GraphWrapper& _G, T a) : Parent(*(_G.graph), a) { } }; }; @@ -252,13 +250,17 @@ } using GraphWrapper::next; - OutEdgeIt& next(OutEdgeIt& i) const { graph->next(i.e); return i; } - InEdgeIt& next(InEdgeIt& i) const { graph->next(i.e); return i; } + OutEdgeIt& next(OutEdgeIt& i) const { this->graph->next(i.e); return i; } + InEdgeIt& next(InEdgeIt& i) const { this->graph->next(i.e); return i; } - Node aNode(const OutEdgeIt& e) const { return Node(graph->aNode(e.e)); } - Node aNode(const InEdgeIt& e) const { return Node(graph->aNode(e.e)); } - Node bNode(const OutEdgeIt& e) const { return Node(graph->bNode(e.e)); } - Node bNode(const InEdgeIt& e) const { return Node(graph->bNode(e.e)); } + Node aNode(const OutEdgeIt& e) const { + return Node(this->graph->aNode(e.e)); } + Node aNode(const InEdgeIt& e) const { + return Node(this->graph->aNode(e.e)); } + Node bNode(const OutEdgeIt& e) const { + return Node(this->graph->bNode(e.e)); } + Node bNode(const InEdgeIt& e) const { + return Node(this->graph->bNode(e.e)); } Node tail(const Edge& e) const { return GraphWrapper::head(e); } @@ -366,30 +368,38 @@ } NodeIt& next(NodeIt& i) const { - graph->next(i.n); - while (graph->valid(i) && !(*node_filter_map)[i.n]) { graph->next(i.n); } + this->graph->next(i.n); + while (this->graph->valid(i) && !(*node_filter_map)[i.n]) { + this->graph->next(i.n); } return i; } OutEdgeIt& next(OutEdgeIt& i) const { - graph->next(i.e); - while (graph->valid(i) && !(*edge_filter_map)[i.e]) { graph->next(i.e); } + this->graph->next(i.e); + while (this->graph->valid(i) && !(*edge_filter_map)[i.e]) { + this->graph->next(i.e); } return i; } InEdgeIt& next(InEdgeIt& i) const { - graph->next(i.e); - while (graph->valid(i) && !(*edge_filter_map)[i.e]) { graph->next(i.e); } + this->graph->next(i.e); + while (this->graph->valid(i) && !(*edge_filter_map)[i.e]) { + this->graph->next(i.e); } return i; } EdgeIt& next(EdgeIt& i) const { - graph->next(i.e); - while (graph->valid(i) && !(*edge_filter_map)[i.e]) { graph->next(i.e); } + this->graph->next(i.e); + while (this->graph->valid(i) && !(*edge_filter_map)[i.e]) { + this->graph->next(i.e); } return i; } - Node aNode(const OutEdgeIt& e) const { return Node(graph->aNode(e.e)); } - Node aNode(const InEdgeIt& e) const { return Node(graph->aNode(e.e)); } - Node bNode(const OutEdgeIt& e) const { return Node(graph->bNode(e.e)); } - Node bNode(const InEdgeIt& e) const { return Node(graph->bNode(e.e)); } + Node aNode(const OutEdgeIt& e) const { + return Node(this->graph->aNode(e.e)); } + Node aNode(const InEdgeIt& e) const { + return Node(this->graph->aNode(e.e)); } + Node bNode(const OutEdgeIt& e) const { + return Node(this->graph->bNode(e.e)); } + Node bNode(const InEdgeIt& e) const { + return Node(this->graph->bNode(e.e)); } ///\todo ///Some doki, please. @@ -469,11 +479,12 @@ // } OutEdgeIt& next(OutEdgeIt& e) const { if (e.out_or_in) { - typename Graph::Node n=graph->tail(e.out); - graph->next(e.out); - if (!graph->valid(e.out)) { e.out_or_in=false; graph->first(e.in, n); } + typename Graph::Node n=this->graph->tail(e.out); + this->graph->next(e.out); + if (!this->graph->valid(e.out)) { + e.out_or_in=false; this->graph->first(e.in, n); } } else { - graph->next(e.in); + this->graph->next(e.in); } return e; } @@ -485,9 +496,11 @@ // } Node aNode(const OutEdgeIt& e) const { - if (e.out_or_in) return graph->tail(e); else return graph->head(e); } + if (e.out_or_in) return this->graph->tail(e); else + return this->graph->head(e); } Node bNode(const OutEdgeIt& e) const { - if (e.out_or_in) return graph->head(e); else return graph->tail(e); } + if (e.out_or_in) return this->graph->head(e); else + return this->graph->tail(e); } }; /// A wrapper for composing the residual graph for directed flow and circulation problems. @@ -645,67 +658,80 @@ // NodeIt& next(NodeIt& n) const { GraphWrapper::next(n); return n; } OutEdgeIt& next(OutEdgeIt& e) const { if (e.forward) { - Node v=graph->aNode(e.out); - graph->next(e.out); - while( graph->valid(e.out) && !(resCap(e)>0) ) { graph->next(e.out); } - if (!graph->valid(e.out)) { + Node v=this->graph->aNode(e.out); + this->graph->next(e.out); + while( this->graph->valid(e.out) && !(resCap(e)>0) ) { + this->graph->next(e.out); } + if (!this->graph->valid(e.out)) { e.forward=false; - graph->first(e.in, v); - while( graph->valid(e.in) && !(resCap(e)>0) ) { graph->next(e.in); } + this->graph->first(e.in, v); + while( this->graph->valid(e.in) && !(resCap(e)>0) ) { + this->graph->next(e.in); } } } else { - graph->next(e.in); - while( graph->valid(e.in) && !(resCap(e)>0) ) { graph->next(e.in); } + this->graph->next(e.in); + while( this->graph->valid(e.in) && !(resCap(e)>0) ) { + this->graph->next(e.in); } } return e; } // FIXME Not tested InEdgeIt& next(InEdgeIt& e) const { if (e.forward) { - Node v=graph->aNode(e.in); - graph->next(e.in); - while( graph->valid(e.in) && !(resCap(e)>0) ) { graph->next(e.in); } - if (!graph->valid(e.in)) { + Node v=this->graph->aNode(e.in); + this->graph->next(e.in); + while( this->graph->valid(e.in) && !(resCap(e)>0) ) { + this->graph->next(e.in); } + if (!this->graph->valid(e.in)) { e.forward=false; - graph->first(e.out, v); - while( graph->valid(e.out) && !(resCap(e)>0) ) { graph->next(e.out); } + this->graph->first(e.out, v); + while( this->graph->valid(e.out) && !(resCap(e)>0) ) { + this->graph->next(e.out); } } } else { - graph->next(e.out); - while( graph->valid(e.out) && !(resCap(e)>0) ) { graph->next(e.out); } + this->graph->next(e.out); + while( this->graph->valid(e.out) && !(resCap(e)>0) ) { + this->graph->next(e.out); } } return e; } EdgeIt& next(EdgeIt& e) const { if (e.forward) { - graph->next(e.e); - while( graph->valid(e.e) && !(resCap(e)>0) ) { graph->next(e.e); } - if (!graph->valid(e.e)) { + this->graph->next(e.e); + while( this->graph->valid(e.e) && !(resCap(e)>0) ) { + this->graph->next(e.e); } + if (!this->graph->valid(e.e)) { e.forward=false; - graph->first(e.e); - while( graph->valid(e.e) && !(resCap(e)>0) ) { graph->next(e.e); } + this->graph->first(e.e); + while( this->graph->valid(e.e) && !(resCap(e)>0) ) { + this->graph->next(e.e); } } } else { - graph->next(e.e); - while( graph->valid(e.e) && !(resCap(e)>0) ) { graph->next(e.e); } + this->graph->next(e.e); + while( this->graph->valid(e.e) && !(resCap(e)>0) ) { + this->graph->next(e.e); } } return e; } Node tail(Edge e) const { - return ((e.forward) ? graph->tail(e) : graph->head(e)); } + return ((e.forward) ? this->graph->tail(e) : this->graph->head(e)); } Node head(Edge e) const { - return ((e.forward) ? graph->head(e) : graph->tail(e)); } + return ((e.forward) ? this->graph->head(e) : this->graph->tail(e)); } Node aNode(OutEdgeIt e) const { - return ((e.forward) ? graph->aNode(e.out) : graph->aNode(e.in)); } + return ((e.forward) ? this->graph->aNode(e.out) : + this->graph->aNode(e.in)); } Node bNode(OutEdgeIt e) const { - return ((e.forward) ? graph->bNode(e.out) : graph->bNode(e.in)); } + return ((e.forward) ? this->graph->bNode(e.out) : + this->graph->bNode(e.in)); } Node aNode(InEdgeIt e) const { - return ((e.forward) ? graph->aNode(e.in) : graph->aNode(e.out)); } + return ((e.forward) ? this->graph->aNode(e.in) : + this->graph->aNode(e.out)); } Node bNode(InEdgeIt e) const { - return ((e.forward) ? graph->bNode(e.in) : graph->bNode(e.out)); } + return ((e.forward) ? this->graph->bNode(e.in) : + this->graph->bNode(e.out)); } // int nodeNum() const { return graph->nodeNum(); } //FIXME @@ -717,7 +743,7 @@ bool valid(Node n) const { return GraphWrapper::valid(n); } bool valid(Edge e) const { - return graph->valid(e); + return this->graph->valid(e); //return e.forward ? graph->valid(e.out) : graph->valid(e.in); } @@ -751,7 +777,7 @@ template class EdgeMap { - typename Graph::EdgeMap forward_map, backward_map; + typename Graph::template EdgeMap forward_map, backward_map; public: EdgeMap(const ResGraphWrapper& _G) : forward_map(*(_G.graph)), backward_map(*(_G.graph)) { } EdgeMap(const ResGraphWrapper& _G, T a) : forward_map(*(_G.graph), a), backward_map(*(_G.graph), a) { } @@ -861,14 +887,18 @@ using GraphWrapper::next; // NodeIt& next(NodeIt& i) const { graph->next(i.n); return i; } - OutEdgeIt& next(OutEdgeIt& i) const { graph->next(i.e); return i; } - InEdgeIt& next(InEdgeIt& i) const { graph->next(i.e); return i; } - EdgeIt& next(EdgeIt& i) const { graph->next(i.e); return i; } + OutEdgeIt& next(OutEdgeIt& i) const { this->graph->next(i.e); return i; } + InEdgeIt& next(InEdgeIt& i) const { this->graph->next(i.e); return i; } + EdgeIt& next(EdgeIt& i) const { this->graph->next(i.e); return i; } - Node aNode(const OutEdgeIt& e) const { return Node(graph->aNode(e.e)); } - Node aNode(const InEdgeIt& e) const { return Node(graph->aNode(e.e)); } - Node bNode(const OutEdgeIt& e) const { return Node(graph->bNode(e.e)); } - Node bNode(const InEdgeIt& e) const { return Node(graph->bNode(e.e)); } + Node aNode(const OutEdgeIt& e) const { + return Node(this->graph->aNode(e.e)); } + Node aNode(const InEdgeIt& e) const { + return Node(this->graph->aNode(e.e)); } + Node bNode(const OutEdgeIt& e) const { + return Node(this->graph->bNode(e.e)); } + Node bNode(const InEdgeIt& e) const { + return Node(this->graph->bNode(e.e)); } void erase(const OutEdgeIt& e) const { OutEdgeIt f=e; @@ -885,7 +915,8 @@ /// graph or a directed graph with edges oriented from S to T. template class BipartiteGraphWrapper : public GraphWrapper { - typedef IterableBoolMap< typename Graph::NodeMap > SFalseTTrueMap; + typedef IterableBoolMap< typename Graph::template NodeMap > + SFalseTTrueMap; SFalseTTrueMap* s_false_t_true_map; public: @@ -983,8 +1014,8 @@ // TNodeIt& next(TNodeIt& n) const { // this->s_false_t_true_map->next(n); return n; // } - OutEdgeIt& next(OutEdgeIt& i) const { graph->next(i.e); return i; } - InEdgeIt& next(InEdgeIt& i) const { graph->next(i.e); return i; } + OutEdgeIt& next(OutEdgeIt& i) const { this->graph->next(i.e); return i; } + InEdgeIt& next(InEdgeIt& i) const { this->graph->next(i.e); return i; } Node tail(const Edge& e) { if (!(*(this->s_false_t_true_map))[this->graph->tail(e)]) @@ -1078,7 +1109,7 @@ protected: friend class GraphWrapper; friend class stGraphWrapper; - template friend class stGraphWrapper::NodeMap; + template friend class NodeMap; friend class Edge; friend class OutEdgeIt; friend class InEdgeIt; @@ -1119,7 +1150,7 @@ class Edge : public Graph::Edge { friend class GraphWrapper; friend class stGraphWrapper; - template friend class stGraphWrapper::EdgeMap; + template friend class EdgeMap; int spec; typename Graph::Node n; public: @@ -1273,8 +1304,8 @@ NodeIt& next(NodeIt& i) const { switch (i.spec) { case 0: - graph->next(i.n); - if (!graph->valid(i.n)) { + this->graph->next(i.n); + if (!this->graph->valid(i.n)) { i.spec=1; } break; @@ -1290,10 +1321,10 @@ OutEdgeIt& next(OutEdgeIt& i) const { switch (i.spec) { case 0: //normal edge - typename Graph::Node v=graph->aNode(i.e); - graph->next(i.e); - if (!graph->valid(i.e)) { //Az igazi elek vegere ertunk - if (graph->inSClass(v)) { //S, nincs kiel + typename Graph::Node v=this->graph->aNode(i.e); + this->graph->next(i.e); + if (!this->graph->valid(i.e)) { //Az igazi elek vegere ertunk + if (this->graph->inSClass(v)) { //S, nincs kiel i.spec=3; i.n=INVALID; } else { //T, van kiel @@ -1303,8 +1334,8 @@ } break; case 1: //s->vmi - graph->next(i.n); - if (!graph->valid(i.n)) i.spec=3; + this->graph->next(i.n); + if (!this->graph->valid(i.n)) i.spec=3; break; case 2: //vmi->t i.spec=3; @@ -1316,10 +1347,10 @@ InEdgeIt& next(InEdgeIt& i) const { switch (i.spec) { case 0: //normal edge - typename Graph::Node v=graph->aNode(i.e); - graph->next(i.e); - if (!graph->valid(i.e)) { //Az igazi elek vegere ertunk - if (graph->inTClass(v)) { //S, nincs beel + typename Graph::Node v=this->graph->aNode(i.e); + this->graph->next(i.e); + if (!this->graph->valid(i.e)) { //Az igazi elek vegere ertunk + if (this->graph->inTClass(v)) { //S, nincs beel i.spec=3; i.n=INVALID; } else { //S, van beel @@ -1333,8 +1364,8 @@ i.n=INVALID; break; case 2: //vmi->t - graph->next(i.n); - if (!graph->valid(i.n)) i.spec=3; + this->graph->next(i.n); + if (!this->graph->valid(i.n)) i.spec=3; break; } return i; @@ -1343,28 +1374,28 @@ EdgeIt& next(EdgeIt& i) const { switch (i.spec) { case 0: - graph->next(i.e); - if (!graph->valid(i.e)) { + this->graph->next(i.e); + if (!this->graph->valid(i.e)) { i.spec=1; - graph->first(n, S_CLASS); - if (!graph->valid(i.n)) { + this->graph->first(i.n, S_CLASS); + if (!this->graph->valid(i.n)) { i.spec=2; - graph->first(n, T_CLASS); - if (!graph->valid(i.n)) spec=3; + this->graph->first(i.n, T_CLASS); + if (!this->graph->valid(i.n)) i.spec=3; } } break; case 1: - graph->next(i.n); - if (!graph->valid(i.n)) { + this->graph->next(i.n); + if (!this->graph->valid(i.n)) { i.spec=2; - graph->first(n, T_CLASS); - if (!graph->valid(i.n)) spec=3; + this->graph->first(i.n, T_CLASS); + if (!this->graph->valid(i.n)) i.spec=3; } break; case 2: - graph->next(i.n); - if (!graph->valid(i.n)) i.spec=3; + this->graph->next(i.n); + if (!this->graph->valid(i.n)) i.spec=3; break; } return i; @@ -1373,7 +1404,7 @@ Node tail(const Edge& e) const { switch (e.spec) { case 0: - return Node(graph->tail(e)); + return Node(this->graph->tail(e)); break; case 1: return S_NODE; @@ -1386,7 +1417,7 @@ Node head(const Edge& e) const { switch (e.spec) { case 0: - return Node(graph->head(e)); + return Node(this->graph->head(e)); break; case 1: return Node(e.n); @@ -1400,30 +1431,31 @@ bool valid(const Node& n) const { return (n.spec<3); } bool valid(const Edge& e) const { return (e.spec<3); } -// int nodeNum() const { return graph->nodeNum(); } -// int edgeNum() const { return graph->edgeNum(); } +// int nodeNum() const { return this->graph->nodeNum(); } +// int edgeNum() const { return this->graph->edgeNum(); } Node aNode(const OutEdgeIt& e) const { return tail(e); } Node aNode(const InEdgeIt& e) const { return head(e); } Node bNode(const OutEdgeIt& e) const { return head(e); } Node bNode(const InEdgeIt& e) const { return tail(e); } -// Node addNode() const { return Node(graph->addNode()); } +// Node addNode() const { return Node(this->graph->addNode()); } // Edge addEdge(const Node& tail, const Node& head) const { -// return Edge(graph->addEdge(tail, head)); } +// return Edge(this->graph->addEdge(tail, head)); } -// void erase(const Node& i) const { graph->erase(i); } -// void erase(const Edge& i) const { graph->erase(i); } +// void erase(const Node& i) const { this->graph->erase(i); } +// void erase(const Edge& i) const { this->graph->erase(i); } -// void clear() const { graph->clear(); } +// void clear() const { this->graph->clear(); } - template class NodeMap : public GraphWrapper::NodeMap { + template class NodeMap : public GraphWrapper::template NodeMap { + typedef typename GraphWrapper::template NodeMap Parent; T s_value, t_value; public: - NodeMap(const stGraphWrapper& _G) : - GraphWrapper::NodeMap(_G) { } - NodeMap(const stGraphWrapper& _G, T a) : - GraphWrapper::NodeMap(_G, a), s_value(a), t_value(a) { } + NodeMap(const stGraphWrapper& _G) : Parent(_G) { } + NodeMap(const stGraphWrapper& _G, T a) : Parent(_G, a), + s_value(a), + t_value(a) { } T operator[](const Node& n) const { switch (n.spec) { case 0: @@ -1440,7 +1472,7 @@ void set(const Node& n, T t) { switch (n.spec) { case 0: - GraphWrapper::NodeMap::set(n, t); + GraphWrapper::template NodeMap::set(n, t); break; case 1: s_value=t; @@ -1452,13 +1484,14 @@ } }; - template class EdgeMap : public GraphWrapper::EdgeMap { - typename GraphWrapper::NodeMap node_value; + template class EdgeMap : public GraphWrapper::template EdgeMap { + typedef typename Graph::template NodeMap Parent; + typename GraphWrapper::template NodeMap node_value; public: - EdgeMap(const stGraphWrapper& _G) : - GraphWrapper::EdgeMap(_G), node_value(_G) { } - EdgeMap(const stGraphWrapper& _G, T a) : - GraphWrapper::EdgeMap(_G, a), node_value(_G, a) { } + EdgeMap(const stGraphWrapper& _G) : Parent(_G), + node_value(_G) { } + EdgeMap(const stGraphWrapper& _G, T a) : Parent(_G, a), + node_value(_G, a) { } T operator[](const Edge& e) const { switch (e.spec) { case 0: diff -r 8aca0af3f30b -r 770cc1f4861f src/work/marci/iterator_bfs_demo.cc --- a/src/work/marci/iterator_bfs_demo.cc Fri Apr 23 21:26:32 2004 +0000 +++ b/src/work/marci/iterator_bfs_demo.cc Sat Apr 24 12:44:41 2004 +0000 @@ -4,7 +4,7 @@ #include #include -#include +//#include #include #include diff -r 8aca0af3f30b -r 770cc1f4861f src/work/marci/makefile --- a/src/work/marci/makefile Fri Apr 23 21:26:32 2004 +0000 +++ b/src/work/marci/makefile Sat Apr 24 12:44:41 2004 +0000 @@ -1,7 +1,7 @@ CXX2 = g++-2.95 -CXX3 := $(shell type -p g++-3.3 || type -p g++-3.2 || type -p g++-3.0 || type -p g++-3 || echo g++) -CXX=$(CXX3) -CC=$(CXX) +#CXX3 := $(shell type -p g++-3.3 || type -p g++-3.2 || type -p g++-3.0 || type -p g++-3 || echo g++) +#CXX=$(CXX3) +#CC=$(CXX) #LEDAROOT ?= /ledasrc/LEDA-4.1 BOOSTROOT ?= /home/marci/boost INCLUDEDIRS ?= -I../../include -I.. -I../{marci,jacint,alpar,klao,akos,athos} -I$(BOOSTROOT) @@ -12,16 +12,17 @@ BINARIES = edmonds_karp_demo iterator_bfs_demo macro_test lg_vs_sg bfsit_vs_byhand bipartite_graph_wrapper_test #gw_vs_not preflow_demo_boost edmonds_karp_demo_boost preflow_demo_jacint preflow_demo_athos edmonds_karp_demo_alpar preflow_demo_leda -all: $(BINARIES) +include ../makefile +#all: $(BINARIES) -.depend dep depend: - -$(CXX) $(INCLUDEDIRS) -M $(BINARIES:=.cc) > .depend #2>/dev/null +#.depend dep depend: +# -$(CXX) $(INCLUDEDIRS) -M $(BINARIES:=.cc) > .depend #2>/dev/null # -g++ $(INCLUDEDIRS) $(LEDAINCLUDE) -M $(LEDABINARIES:=.cc) >> .depend #2>/dev/null -makefile: .depend -sinclude .depend +#makefile: .depend +#sinclude .depend leda_graph_demo.o: $(CXX3) -Wall -O -I.. -I../alpar -I$(LEDAROOT)/incl -I. -c leda_graph_demo.cc @@ -72,7 +73,7 @@ preflow_demo_athos: $(CXX3) $(CXXFLAGS) -I. -I.. -I../athos -o preflow_demo_athos preflow_demo_athos.cc -clean: - $(RM) *.o $(BINARIES) .depend - -.PHONY: all clean dep depend +#clean: +# $(RM) *.o $(BINARIES) .depend +# +#.PHONY: all clean dep depend