[Lemon-commits] [lemon_svn] marci: r520 - in hugo/trunk/src: include work work/jacint work/marci
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 20:39:56 CET 2006
Author: marci
Date: Sat Apr 24 14:44:41 2004
New Revision: 520
Modified:
hugo/trunk/src/include/invalid.h
hugo/trunk/src/include/maps.h
hugo/trunk/src/work/jacint/preflow.h
hugo/trunk/src/work/list_graph.h
hugo/trunk/src/work/makefile
hugo/trunk/src/work/marci/bfs_iterator.h
hugo/trunk/src/work/marci/bfsit_vs_byhand.cc
hugo/trunk/src/work/marci/bipartite_graph_wrapper_test.cc
hugo/trunk/src/work/marci/edmonds_karp.h
hugo/trunk/src/work/marci/edmonds_karp_demo.cc
hugo/trunk/src/work/marci/graph_wrapper.h
hugo/trunk/src/work/marci/iterator_bfs_demo.cc
hugo/trunk/src/work/marci/makefile
Log:
modifications for better compatibility with gcc 3.4.0
Modified: hugo/trunk/src/include/invalid.h
==============================================================================
--- hugo/trunk/src/include/invalid.h (original)
+++ hugo/trunk/src/include/invalid.h Sat Apr 24 14:44:41 2004
@@ -27,7 +27,7 @@
//const Invalid &INVALID = *(Invalid *)0;
const Invalid INVALID = Invalid();
-};
+} //namespace hugo
#endif
Modified: hugo/trunk/src/include/maps.h
==============================================================================
--- hugo/trunk/src/include/maps.h (original)
+++ hugo/trunk/src/include/maps.h Sat Apr 24 14:44:41 2004
@@ -92,13 +92,16 @@
StdMap(const parent &m, const T& _v) : parent(m), v(_v) {}
template<typename T1, typename Comp1>
- StdMap(const StdMap<Key,T1,Comp1> &m, const T &_v) { FIXME; }
+ StdMap(const StdMap<Key,T1,Comp1> &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;
Modified: hugo/trunk/src/work/jacint/preflow.h
==============================================================================
--- hugo/trunk/src/work/jacint/preflow.h (original)
+++ hugo/trunk/src/work/jacint/preflow.h Sat Apr 24 14:44:41 2004
@@ -52,8 +52,8 @@
namespace hugo {
template <typename Graph, typename T,
- typename CapMap=typename Graph::EdgeMap<T>,
- typename FlowMap=typename Graph::EdgeMap<T> >
+ typename CapMap=typename Graph::template EdgeMap<T>,
+ typename FlowMap=typename Graph::template EdgeMap<T> >
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<int> level(G,n);
- typename Graph::NodeMap<T> excess(G);
+ typename Graph::template NodeMap<int> level(G,n);
+ typename Graph::template NodeMap<T> excess(G);
std::vector<Node> active(n-1,INVALID);
- typename Graph::NodeMap<Node> next(G,INVALID);
+ typename Graph::template NodeMap<Node> next(G,INVALID);
//Stack of the active nodes in level i < n.
//We use it in both phases.
- typename Graph::NodeMap<Node> left(G,INVALID);
- typename Graph::NodeMap<Node> right(G,INVALID);
+ typename Graph::template NodeMap<Node> left(G,INVALID);
+ typename Graph::template NodeMap<Node> right(G,INVALID);
std::vector<Node> level_list(n,INVALID);
/*
List of the nodes in level i<n.
Modified: hugo/trunk/src/work/list_graph.h
==============================================================================
--- hugo/trunk/src/work/list_graph.h (original)
+++ hugo/trunk/src/work/list_graph.h Sat Apr 24 14:44:41 2004
@@ -29,7 +29,7 @@
class SymEdgeIt;
template <typename T> class NodeMap;
template <typename T> class EdgeMap;
- private:
+// private:
template <typename T> friend class NodeMap;
template <typename T> 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;
Modified: hugo/trunk/src/work/makefile
==============================================================================
--- hugo/trunk/src/work/makefile (original)
+++ hugo/trunk/src/work/makefile Sat Apr 24 14:44:41 2004
@@ -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)
Modified: hugo/trunk/src/work/marci/bfs_iterator.h
==============================================================================
--- hugo/trunk/src/work/marci/bfs_iterator.h (original)
+++ hugo/trunk/src/work/marci/bfs_iterator.h Sat Apr 24 14:44:41 2004
@@ -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<OutEdgeIt>& getDfsStack() const { return dfs_stack; }
};
Modified: hugo/trunk/src/work/marci/bfsit_vs_byhand.cc
==============================================================================
--- hugo/trunk/src/work/marci/bfsit_vs_byhand.cc (original)
+++ hugo/trunk/src/work/marci/bfsit_vs_byhand.cc Sat Apr 24 14:44:41 2004
@@ -3,7 +3,7 @@
#include <fstream>
#include <list_graph.h>
-#include <smart_graph.h>
+//#include <smart_graph.h>
#include <dimacs.h>
#include <time_measure.h>
#include <for_each_macros.h>
Modified: hugo/trunk/src/work/marci/bipartite_graph_wrapper_test.cc
==============================================================================
--- hugo/trunk/src/work/marci/bipartite_graph_wrapper_test.cc (original)
+++ hugo/trunk/src/work/marci/bipartite_graph_wrapper_test.cc Sat Apr 24 14:44:41 2004
@@ -4,7 +4,7 @@
#include <vector>
#include <list_graph.h>
-#include <smart_graph.h>
+//#include <smart_graph.h>
//#include <dimacs.h>
#include <time_measure.h>
#include <for_each_macros.h>
Modified: hugo/trunk/src/work/marci/edmonds_karp.h
==============================================================================
--- hugo/trunk/src/work/marci/edmonds_karp.h (original)
+++ hugo/trunk/src/work/marci/edmonds_karp.h Sat Apr 24 14:44:41 2004
@@ -275,13 +275,14 @@
ResGW res_graph(*g, *capacity, *flow);
bool _augment=false;
- BfsIterator< ResGW, typename ResGW::NodeMap<bool> > bfs(res_graph);
+ BfsIterator< ResGW, typename ResGW::template NodeMap<bool> >
+ bfs(res_graph);
bfs.pushAndSetReached(s);
- typename ResGW::NodeMap<ResGWEdge> pred(res_graph);
+ typename ResGW::template NodeMap<ResGWEdge> pred(res_graph);
pred.set(s, INVALID);
- typename ResGW::NodeMap<Number> free(res_graph);
+ typename ResGW::template NodeMap<Number> free(res_graph);
//searching for augmenting path
while ( !bfs.finished() ) {
@@ -318,7 +319,7 @@
class DistanceMap {
protected:
const MapGraphWrapper* g;
- typename MapGraphWrapper::NodeMap<int> dist;
+ typename MapGraphWrapper::template NodeMap<int> 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<bool> > bfs(res_graph);
+ BfsIterator< ResGW, typename ResGW::template NodeMap<bool> >
+ bfs(res_graph);
bfs.pushAndSetReached(s);
//typename ResGW::NodeMap<int> dist(res_graph); //filled up with 0's
@@ -357,7 +359,8 @@
typedef SubGraphWrapper<ResGW, ConstMap<typename ResGW::Node, bool>,
DistanceMap<ResGW> > FilterResGW;
FilterResGW filter_res_graph(res_graph, true_map, dist);
- typename ResGW::NodeMap<typename MG::Node> res_graph_to_F(res_graph);
+ typename ResGW::template NodeMap<typename MG::Node>
+ 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<ResGWEdge> original_edge(F);
- typename MG::EdgeMap<Number> residual_capacity(F);
+ typename MG::template EdgeMap<ResGWEdge> original_edge(F);
+ typename MG::template EdgeMap<Number> 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<bool> > dfs(F);
- typename MG::NodeMap<typename MG::Edge> pred(F);
+ DfsIterator< MG, typename MG::template NodeMap<bool> > dfs(F);
+ typename MG::template NodeMap<typename MG::Edge> pred(F);
pred.set(sF, INVALID);
//invalid iterators for sources
- typename MG::NodeMap<Number> free(F);
+ typename MG::template NodeMap<Number> 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<bool> > bfs(res_graph);
+ BfsIterator< ResGW, typename ResGW::template NodeMap<bool> >
+ bfs(res_graph);
bfs.pushAndSetReached(s);
- typename ResGW::NodeMap<int> dist(res_graph); //filled up with 0's
+ typename ResGW::template NodeMap<int>
+ 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<typename MG::Node> res_graph_to_F(res_graph);
+ typename ResGW::template NodeMap<typename MG::Node>
+ 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<ResGWEdge> original_edge(F);
- typename MG::EdgeMap<Number> residual_capacity(F);
+ typename MG::template EdgeMap<ResGWEdge> original_edge(F);
+ typename MG::template EdgeMap<Number> 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<bool> > dfs(F);
- typename MG::NodeMap<typename MG::Edge> pred(F);
+ DfsIterator< MG, typename MG::template NodeMap<bool> > dfs(F);
+ typename MG::template NodeMap<typename MG::Edge> pred(F);
pred.set(sF, INVALID);
//invalid iterators for sources
- typename MG::NodeMap<Number> free(F);
+ typename MG::template NodeMap<Number> free(F);
dfs.pushAndSetReached(sF);
while (!dfs.finished()) {
@@ -553,7 +559,8 @@
ResGW res_graph(*g, *capacity, *flow);
- BfsIterator< ResGW, typename ResGW::NodeMap<bool> > bfs(res_graph);
+ BfsIterator< ResGW, typename ResGW::template NodeMap<bool> >
+ bfs(res_graph);
bfs.pushAndSetReached(s);
DistanceMap<ResGW> 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::OutEdgeIt>
+ typename FilterResGW::template NodeMap<typename FilterResGW::OutEdgeIt>
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<FilterResGW, typename FilterResGW::
- NodeMap<typename FilterResGW::OutEdgeIt> > ErasingResGW;
+ template NodeMap<typename FilterResGW::OutEdgeIt> > 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<bool> >
+ DfsIterator< ErasingResGW,
+ typename ErasingResGW::template NodeMap<bool> >
dfs(erasing_res_graph);
- typename ErasingResGW::NodeMap<typename ErasingResGW::OutEdgeIt>
- pred(erasing_res_graph);
+ typename ErasingResGW::
+ template NodeMap<typename ErasingResGW::OutEdgeIt>
+ pred(erasing_res_graph);
pred.set(s, INVALID);
//invalid iterators for sources
- typename ErasingResGW::NodeMap<Number> free1(erasing_res_graph);
+ typename ErasingResGW::template NodeMap<Number>
+ free1(erasing_res_graph);
dfs.pushAndSetReached(
typename ErasingResGW::Node(
Modified: hugo/trunk/src/work/marci/edmonds_karp_demo.cc
==============================================================================
--- hugo/trunk/src/work/marci/edmonds_karp_demo.cc (original)
+++ hugo/trunk/src/work/marci/edmonds_karp_demo.cc Sat Apr 24 14:44:41 2004
@@ -3,7 +3,7 @@
#include <fstream>
#include <list_graph.h>
-#include <smart_graph.h>
+//#include <smart_graph.h>
#include <dimacs.h>
#include <edmonds_karp.h>
#include <time_measure.h>
Modified: hugo/trunk/src/work/marci/graph_wrapper.h
==============================================================================
--- hugo/trunk/src/work/marci/graph_wrapper.h (original)
+++ hugo/trunk/src/work/marci/graph_wrapper.h Sat Apr 24 14:44:41 2004
@@ -183,20 +183,18 @@
void clear() const { graph->clear(); }
- template<typename T> class NodeMap : public Graph::NodeMap<T> {
+ template<typename T> class NodeMap : public Graph::template NodeMap<T> {
+ typedef typename Graph::template NodeMap<T> Parent;
public:
- NodeMap(const GraphWrapper<Graph>& _G) :
- Graph::NodeMap<T>(*(_G.graph)) { }
- NodeMap(const GraphWrapper<Graph>& _G, T a) :
- Graph::NodeMap<T>(*(_G.graph), a) { }
+ NodeMap(const GraphWrapper<Graph>& _G) : Parent(*(_G.graph)) { }
+ NodeMap(const GraphWrapper<Graph>& _G, T a) : Parent(*(_G.graph), a) { }
};
- template<typename T> class EdgeMap : public Graph::EdgeMap<T> {
+ template<typename T> class EdgeMap : public Graph::template EdgeMap<T> {
+ typedef typename Graph::template EdgeMap<T> Parent;
public:
- EdgeMap(const GraphWrapper<Graph>& _G) :
- Graph::EdgeMap<T>(*(_G.graph)) { }
- EdgeMap(const GraphWrapper<Graph>& _G, T a) :
- Graph::EdgeMap<T>(*(_G.graph), a) { }
+ EdgeMap(const GraphWrapper<Graph>& _G) : Parent(*(_G.graph)) { }
+ EdgeMap(const GraphWrapper<Graph>& _G, T a) : Parent(*(_G.graph), a) { }
};
};
@@ -252,13 +250,17 @@
}
using GraphWrapper<Graph>::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<Graph>::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<Graph>::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<Graph>::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 <typename T>
class EdgeMap {
- typename Graph::EdgeMap<T> forward_map, backward_map;
+ typename Graph::template EdgeMap<T> forward_map, backward_map;
public:
EdgeMap(const ResGraphWrapper<Graph, Number, CapacityMap, FlowMap>& _G) : forward_map(*(_G.graph)), backward_map(*(_G.graph)) { }
EdgeMap(const ResGraphWrapper<Graph, Number, CapacityMap, FlowMap>& _G, T a) : forward_map(*(_G.graph), a), backward_map(*(_G.graph), a) { }
@@ -861,14 +887,18 @@
using GraphWrapper<Graph>::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<typename Graph>
class BipartiteGraphWrapper : public GraphWrapper<Graph> {
- typedef IterableBoolMap< typename Graph::NodeMap<int> > SFalseTTrueMap;
+ typedef IterableBoolMap< typename Graph::template NodeMap<int> >
+ 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<Graph>;
friend class stGraphWrapper<Graph>;
- template <typename T> friend class stGraphWrapper<Graph>::NodeMap;
+ template <typename T> friend class NodeMap;
friend class Edge;
friend class OutEdgeIt;
friend class InEdgeIt;
@@ -1119,7 +1150,7 @@
class Edge : public Graph::Edge {
friend class GraphWrapper<Graph>;
friend class stGraphWrapper<Graph>;
- template <typename T> friend class stGraphWrapper<Graph>::EdgeMap;
+ template <typename T> 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<typename T> class NodeMap : public GraphWrapper<Graph>::NodeMap<T> {
+ template<typename T> class NodeMap : public GraphWrapper<Graph>::template NodeMap<T> {
+ typedef typename GraphWrapper<Graph>::template NodeMap<T> Parent;
T s_value, t_value;
public:
- NodeMap(const stGraphWrapper<Graph>& _G) :
- GraphWrapper<Graph>::NodeMap<T>(_G) { }
- NodeMap(const stGraphWrapper<Graph>& _G, T a) :
- GraphWrapper<Graph>::NodeMap<T>(_G, a), s_value(a), t_value(a) { }
+ NodeMap(const stGraphWrapper<Graph>& _G) : Parent(_G) { }
+ NodeMap(const stGraphWrapper<Graph>& _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<Graph>::NodeMap<T>::set(n, t);
+ GraphWrapper<Graph>::template NodeMap<T>::set(n, t);
break;
case 1:
s_value=t;
@@ -1452,13 +1484,14 @@
}
};
- template<typename T> class EdgeMap : public GraphWrapper<Graph>::EdgeMap<T> {
- typename GraphWrapper<Graph>::NodeMap<T> node_value;
- public:
- EdgeMap(const stGraphWrapper<Graph>& _G) :
- GraphWrapper<Graph>::EdgeMap<T>(_G), node_value(_G) { }
- EdgeMap(const stGraphWrapper<Graph>& _G, T a) :
- GraphWrapper<Graph>::EdgeMap<T>(_G, a), node_value(_G, a) { }
+ template<typename T> class EdgeMap : public GraphWrapper<Graph>::template EdgeMap<T> {
+ typedef typename Graph::template NodeMap<T> Parent;
+ typename GraphWrapper<Graph>::template NodeMap<T> node_value;
+ public:
+ EdgeMap(const stGraphWrapper<Graph>& _G) : Parent(_G),
+ node_value(_G) { }
+ EdgeMap(const stGraphWrapper<Graph>& _G, T a) : Parent(_G, a),
+ node_value(_G, a) { }
T operator[](const Edge& e) const {
switch (e.spec) {
case 0:
Modified: hugo/trunk/src/work/marci/iterator_bfs_demo.cc
==============================================================================
--- hugo/trunk/src/work/marci/iterator_bfs_demo.cc (original)
+++ hugo/trunk/src/work/marci/iterator_bfs_demo.cc Sat Apr 24 14:44:41 2004
@@ -4,7 +4,7 @@
#include <string>
#include <list_graph.h>
-#include <smart_graph.h>
+//#include <smart_graph.h>
#include <bfs_iterator.h>
#include <graph_wrapper.h>
Modified: hugo/trunk/src/work/marci/makefile
==============================================================================
--- hugo/trunk/src/work/marci/makefile (original)
+++ hugo/trunk/src/work/marci/makefile Sat Apr 24 14:44:41 2004
@@ -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
More information about the Lemon-commits
mailing list