# HG changeset patch # User alpar # Date 1077313507 0 # Node ID a3c73e9b9b2e772734acbe1665d25ccdded31678 # Parent 7a2d991e9852aa1326fbd98b329c373a064fee0b marci -> hugo replacements resize -> update replacements diff -r 7a2d991e9852 -r a3c73e9b9b2e src/work/alpar/gwrapper.h --- a/src/work/alpar/gwrapper.h Fri Feb 20 00:29:19 2004 +0000 +++ b/src/work/alpar/gwrapper.h Fri Feb 20 21:45:07 2004 +0000 @@ -2,7 +2,7 @@ #ifndef GRAPH_WRAPPER_H #define GRAPH_WRAPPER_H -namespace marci { +namespace hugo { template class TrivGraphWrapper diff -r 7a2d991e9852 -r a3c73e9b9b2e src/work/alpar/smart_graph.h --- a/src/work/alpar/smart_graph.h Fri Feb 20 00:29:19 2004 +0000 +++ b/src/work/alpar/smart_graph.h Fri Feb 20 21:45:07 2004 +0000 @@ -1,10 +1,12 @@ +// -*- mode:C++ -*- + #ifndef SMART_GRAPH_H #define SMART_GRAPH_H #include #include -namespace marci { +namespace hugo { class SmartGraph { @@ -35,58 +37,17 @@ class OutEdgeIt; class InEdgeIt; -// class NodeIt { int n; }; -// class EachNodeIt : public NodeIt { }; -// class EdgeIt { int n; }; -// class EachEdgeIt : public EdgeIt {}; -// class OutEdgeIt : public EdgeIt {}; -// class InEdgeIt : public EdgeIt {}; + // class NodeIt { int n; }; + // class EachNodeIt : public NodeIt { }; + // class EdgeIt { int n; }; + // class EachEdgeIt : public EdgeIt {}; + // class OutEdgeIt : public EdgeIt {}; + // class InEdgeIt : public EdgeIt {}; // class SymEdgeIt; - - template class NodeMap; + + template class NodeMap; template class EdgeMap; - private: - - template friend class NodeMap; - template friend class EdgeMap; - - template - class NodeMap { - const SmartGraph& G; - std::vector container; - public: - typedef T ValueType; - typedef NodeIt KeyType; - NodeMap(const SmartGraph& _G) : G(_G), container(G.nodeNum()) { } - NodeMap(const SmartGraph& _G, T a) : - G(_G), container(G.nodeNum(), a) { } - void set(NodeIt n, T a) { container[n.n]=a; } - T get(NodeIt n) const { return container[n.n]; } - T& operator[](NodeIt n) { return container[n.n]; } - const T& operator[](NodeIt n) const { return container[n.n]; } - void resize() { container.resize(G.nodeNum()); } - void resize(T a) { container.resize(G.nodeNum(), a); } - }; - - template - class EdgeMap { - const SmartGraph& G; - std::vector container; - public: - typedef T ValueType; - typedef EdgeIt KeyType; - EdgeMap(const SmartGraph& _G) : G(_G), container(G.edgeNum()) { } - EdgeMap(const SmartGraph& _G, T a) : - G(_G), container(G.edgeNum(), a) { } - void set(EdgeIt e, T a) { container[e.n]=a; } - T get(EdgeIt e) const { return container[e.n]; } - T& operator[](EdgeIt e) { return container[e.n]; } - const T& operator[](EdgeIt e) const { return container[e.n]; } - void resize() { container.resize(G.edgeNum()); } - void resize(T a) { container.resize(G.edgeNum(), a); } - }; - public: /* default constructor */ @@ -136,8 +97,9 @@ bool valid(EachEdgeIt e) const { return e.n It next(It it) const { - It tmp(it); return goNext(it); } + template It next(It it) const + // { It tmp(it); return goNext(tmp); } + { It tmp; tmp.n=it.n+1; return tmp; } NodeIt& goNext(NodeIt& it) const { ++it.n; return it; } OutEdgeIt& goNext(OutEdgeIt& it) const @@ -228,7 +190,49 @@ InEdgeIt() : EdgeIt() { } InEdgeIt(const SmartGraph& G,NodeIt v) :EdgeIt(G.nodes[v.n].first_in){} }; + + // Map types + + template + class NodeMap { + const SmartGraph& G; + std::vector container; + public: + typedef T ValueType; + typedef NodeIt KeyType; + NodeMap(const SmartGraph& _G) : G(_G), container(G.nodeNum()) { } + NodeMap(const SmartGraph& _G, T a) : + G(_G), container(G.nodeNum(), a) { } + void set(NodeIt n, T a) { container[n.n]=a; } + T get(NodeIt n) const { return container[n.n]; } + T& operator[](NodeIt n) { return container[n.n]; } + const T& operator[](NodeIt n) const { return container[n.n]; } + void update() { container.resize(G.nodeNum()); } + void update(T a) { container.resize(G.nodeNum(), a); } + }; + + template + class EdgeMap { + const SmartGraph& G; + std::vector container; + public: + typedef T ValueType; + typedef EdgeIt KeyType; + EdgeMap(const SmartGraph& _G) : G(_G), container(G.edgeNum()) { } + EdgeMap(const SmartGraph& _G, T a) : + G(_G), container(G.edgeNum(), a) { } + void set(EdgeIt e, T a) { container[e.n]=a; } + T get(EdgeIt e) const { return container[e.n]; } + T& operator[](EdgeIt e) { return container[e.n]; } + const T& operator[](EdgeIt e) const { return container[e.n]; } + void update() { container.resize(G.edgeNum()); } + void update(T a) { container.resize(G.edgeNum(), a); } + }; + + + + }; -} //namespace marci +} //namespace hugo #endif //SMART_GRAPH_H diff -r 7a2d991e9852 -r a3c73e9b9b2e src/work/athos/pf_demo.cc --- a/src/work/athos/pf_demo.cc Fri Feb 20 00:29:19 2004 +0000 +++ b/src/work/athos/pf_demo.cc Fri Feb 20 21:45:07 2004 +0000 @@ -7,7 +7,7 @@ //#include "marci_property_vector.hh" #include "preflow_push.hh" -using namespace marci; +using namespace hugo; int main (int, char*[]) diff -r 7a2d991e9852 -r a3c73e9b9b2e src/work/athos/preflow_push.hh --- a/src/work/athos/preflow_push.hh Fri Feb 20 00:29:19 2004 +0000 +++ b/src/work/athos/preflow_push.hh Fri Feb 20 21:45:07 2004 +0000 @@ -12,7 +12,7 @@ using namespace std; -namespace marci { +namespace hugo { template class preflow_push { @@ -434,6 +434,6 @@ }//run -}//namespace marci +}//namespace hugo #endif //PREFLOW_PUSH_HH diff -r 7a2d991e9852 -r a3c73e9b9b2e src/work/athos/reverse_bfs.hh --- a/src/work/athos/reverse_bfs.hh Fri Feb 20 00:29:19 2004 +0000 +++ b/src/work/athos/reverse_bfs.hh Fri Feb 20 21:45:07 2004 +0000 @@ -96,7 +96,7 @@ }; -} // namespace marci +} // namespace hugo #endif //REVERSE_BFS_HH diff -r 7a2d991e9852 -r a3c73e9b9b2e src/work/bfs_iterator.hh --- a/src/work/bfs_iterator.hh Fri Feb 20 00:29:19 2004 +0000 +++ b/src/work/bfs_iterator.hh Fri Feb 20 21:45:07 2004 +0000 @@ -6,7 +6,7 @@ #include #include -namespace marci { +namespace hugo { template struct bfs { @@ -755,6 +755,6 @@ -} // namespace marci +} // namespace hugo #endif //BFS_ITERATOR_HH diff -r 7a2d991e9852 -r a3c73e9b9b2e src/work/bin_heap_demo.cc --- a/src/work/bin_heap_demo.cc Fri Feb 20 00:29:19 2004 +0000 +++ b/src/work/bin_heap_demo.cc Fri Feb 20 21:45:07 2004 +0000 @@ -3,7 +3,7 @@ #include #include -using namespace marci; +using namespace hugo; using namespace std; class string_int_map; diff -r 7a2d991e9852 -r a3c73e9b9b2e src/work/jacint/dijkstra.hh --- a/src/work/jacint/dijkstra.hh Fri Feb 20 00:29:19 2004 +0000 +++ b/src/work/jacint/dijkstra.hh Fri Feb 20 21:45:07 2004 +0000 @@ -52,7 +52,7 @@ namespace std { - namespace marci { + namespace hugo { @@ -185,7 +185,7 @@ - } // namespace marci + } // namespace hugo } #endif //DIJKSTRA_HH diff -r 7a2d991e9852 -r a3c73e9b9b2e src/work/jacint/flow_test.cc --- a/src/work/jacint/flow_test.cc Fri Feb 20 00:29:19 2004 +0000 +++ b/src/work/jacint/flow_test.cc Fri Feb 20 21:45:07 2004 +0000 @@ -8,7 +8,7 @@ #include //#include -using namespace marci; +using namespace hugo; int main (int, char*[]) diff -r 7a2d991e9852 -r a3c73e9b9b2e src/work/jacint/preflow_hl2.h --- a/src/work/jacint/preflow_hl2.h Fri Feb 20 00:29:19 2004 +0000 +++ b/src/work/jacint/preflow_hl2.h Fri Feb 20 21:45:07 2004 +0000 @@ -41,7 +41,7 @@ #include #include -namespace marci { +namespace hugo { template , typename CapMap=typename Graph::EdgeMap, @@ -396,7 +396,7 @@ }; -}//namespace marci +}//namespace hugo #endif diff -r 7a2d991e9852 -r a3c73e9b9b2e src/work/jacint/preflow_hl3.h --- a/src/work/jacint/preflow_hl3.h Fri Feb 20 00:29:19 2004 +0000 +++ b/src/work/jacint/preflow_hl3.h Fri Feb 20 21:45:07 2004 +0000 @@ -44,7 +44,7 @@ #include #include -namespace marci { +namespace hugo { template , typename CapMap=typename Graph::EdgeMap, @@ -464,7 +464,7 @@ }; -}//namespace marci +}//namespace hugo #endif diff -r 7a2d991e9852 -r a3c73e9b9b2e src/work/jacint/preflow_hl4.h --- a/src/work/jacint/preflow_hl4.h Fri Feb 20 00:29:19 2004 +0000 +++ b/src/work/jacint/preflow_hl4.h Fri Feb 20 21:45:07 2004 +0000 @@ -44,7 +44,7 @@ #include #include -namespace marci { +namespace hugo { template , @@ -478,7 +478,7 @@ }; -}//namespace marci +}//namespace hugo #endif diff -r 7a2d991e9852 -r a3c73e9b9b2e src/work/jacint/preflow_push_hl.h --- a/src/work/jacint/preflow_push_hl.h Fri Feb 20 00:29:19 2004 +0000 +++ b/src/work/jacint/preflow_push_hl.h Fri Feb 20 21:45:07 2004 +0000 @@ -43,7 +43,7 @@ #include #include -namespace marci { +namespace hugo { template , typename CapMap=typename Graph::EdgeMap, @@ -390,7 +390,7 @@ }; -}//namespace marci +}//namespace hugo #endif diff -r 7a2d991e9852 -r a3c73e9b9b2e src/work/jacint/preflow_push_hl.hh --- a/src/work/jacint/preflow_push_hl.hh Fri Feb 20 00:29:19 2004 +0000 +++ b/src/work/jacint/preflow_push_hl.hh Fri Feb 20 21:45:07 2004 +0000 @@ -32,7 +32,7 @@ #include #include -namespace marci { +namespace hugo { template class preflow_push_hl { @@ -312,7 +312,7 @@ }; -}//namespace marci +}//namespace hugo #endif diff -r 7a2d991e9852 -r a3c73e9b9b2e src/work/jacint/preflow_push_max_flow.h --- a/src/work/jacint/preflow_push_max_flow.h Fri Feb 20 00:29:19 2004 +0000 +++ b/src/work/jacint/preflow_push_max_flow.h Fri Feb 20 21:45:07 2004 +0000 @@ -33,7 +33,7 @@ #include -namespace marci { +namespace hugo { template , typename CapMap=typename Graph::EdgeMap, @@ -287,7 +287,7 @@ }; -}//namespace marci +}//namespace hugo #endif diff -r 7a2d991e9852 -r a3c73e9b9b2e src/work/jacint/preflow_push_max_flow.hh --- a/src/work/jacint/preflow_push_max_flow.hh Fri Feb 20 00:29:19 2004 +0000 +++ b/src/work/jacint/preflow_push_max_flow.hh Fri Feb 20 21:45:07 2004 +0000 @@ -32,7 +32,7 @@ #include -namespace marci { +namespace hugo { template class preflow_push_max_flow { @@ -306,7 +306,7 @@ }; -}//namespace marci +}//namespace hugo #endif diff -r 7a2d991e9852 -r a3c73e9b9b2e src/work/jacint/reverse_bfs.h --- a/src/work/jacint/reverse_bfs.h Fri Feb 20 00:29:19 2004 +0000 +++ b/src/work/jacint/reverse_bfs.h Fri Feb 20 21:45:07 2004 +0000 @@ -82,7 +82,7 @@ }; -} // namespace marci +} // namespace hugo #endif //REVERSE_BFS_HH diff -r 7a2d991e9852 -r a3c73e9b9b2e src/work/jacint/reverse_bfs.hh --- a/src/work/jacint/reverse_bfs.hh Fri Feb 20 00:29:19 2004 +0000 +++ b/src/work/jacint/reverse_bfs.hh Fri Feb 20 21:45:07 2004 +0000 @@ -87,7 +87,7 @@ }; -} // namespace marci +} // namespace hugo #endif //REVERSE_BFS_HH diff -r 7a2d991e9852 -r a3c73e9b9b2e src/work/marci/dimacs.hh --- a/src/work/marci/dimacs.hh Fri Feb 20 00:29:19 2004 +0000 +++ b/src/work/marci/dimacs.hh Fri Feb 20 21:45:07 2004 +0000 @@ -5,7 +5,7 @@ #include #include -namespace marci { +namespace hugo { template void readDimacsMaxFlow(std::istream& is, Graph &G, typename Graph::NodeIt &s, typename Graph::NodeIt &t, CapacityMap& capacity) { @@ -49,13 +49,13 @@ is >> i >> j >> cap; getline(is, str); typename Graph::EdgeIt e=G.addEdge(nodes[i], nodes[j]); - capacity.resize(); + capacity.update(); capacity.set(e, cap); break; } } } -} //namespace marci +} //namespace hugo #endif //DIMACS_HH diff -r 7a2d991e9852 -r a3c73e9b9b2e src/work/marci/edmonds_karp_demo.cc --- a/src/work/marci/edmonds_karp_demo.cc Fri Feb 20 00:29:19 2004 +0000 +++ b/src/work/marci/edmonds_karp_demo.cc Fri Feb 20 21:45:07 2004 +0000 @@ -6,7 +6,7 @@ #include #include -using namespace marci; +using namespace hugo; // Use a DIMACS max flow file as stdin. // read_dimacs_demo < dimacs_max_flow_file diff -r 7a2d991e9852 -r a3c73e9b9b2e src/work/marci/graph_wrapper.h --- a/src/work/marci/graph_wrapper.h Fri Feb 20 00:29:19 2004 +0000 +++ b/src/work/marci/graph_wrapper.h Fri Feb 20 21:45:07 2004 +0000 @@ -2,7 +2,7 @@ #ifndef GRAPH_WRAPPER_H #define GRAPH_WRAPPER_H -namespace marci { +namespace hugo { template class TrivGraphWrapper { @@ -573,7 +573,7 @@ -} //namespace marci +} //namespace hugo #endif //GRAPH_WRAPPER_H diff -r 7a2d991e9852 -r a3c73e9b9b2e src/work/marci/preflow_demo_athos.cc --- a/src/work/marci/preflow_demo_athos.cc Fri Feb 20 00:29:19 2004 +0000 +++ b/src/work/marci/preflow_demo_athos.cc Fri Feb 20 21:45:07 2004 +0000 @@ -6,7 +6,7 @@ #include #include -using namespace marci; +using namespace hugo; // Use a DIMACS max flow file as stdin. // read_dimacs_demo < dimacs_max_flow_file diff -r 7a2d991e9852 -r a3c73e9b9b2e src/work/marci/preflow_demo_jacint.cc --- a/src/work/marci/preflow_demo_jacint.cc Fri Feb 20 00:29:19 2004 +0000 +++ b/src/work/marci/preflow_demo_jacint.cc Fri Feb 20 21:45:07 2004 +0000 @@ -7,7 +7,7 @@ #include #include -using namespace marci; +using namespace hugo; // Use a DIMACS max flow file as stdin. // read_dimacs_demo < dimacs_max_flow_file