[Lemon-commits] [lemon_svn] alpar: r140 - in hugo/trunk/src/work: . alpar athos jacint marci
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 20:37:44 CET 2006
Author: alpar
Date: Fri Feb 20 22:45:07 2004
New Revision: 140
Modified:
hugo/trunk/src/work/alpar/gwrapper.h
hugo/trunk/src/work/alpar/smart_graph.h
hugo/trunk/src/work/athos/pf_demo.cc
hugo/trunk/src/work/athos/preflow_push.hh
hugo/trunk/src/work/athos/reverse_bfs.hh
hugo/trunk/src/work/bfs_iterator.hh
hugo/trunk/src/work/bin_heap_demo.cc
hugo/trunk/src/work/jacint/dijkstra.hh
hugo/trunk/src/work/jacint/flow_test.cc
hugo/trunk/src/work/jacint/preflow_hl2.h
hugo/trunk/src/work/jacint/preflow_hl3.h
hugo/trunk/src/work/jacint/preflow_hl4.h
hugo/trunk/src/work/jacint/preflow_push_hl.h
hugo/trunk/src/work/jacint/preflow_push_hl.hh
hugo/trunk/src/work/jacint/preflow_push_max_flow.h
hugo/trunk/src/work/jacint/preflow_push_max_flow.hh
hugo/trunk/src/work/jacint/reverse_bfs.h
hugo/trunk/src/work/jacint/reverse_bfs.hh
hugo/trunk/src/work/marci/dimacs.hh
hugo/trunk/src/work/marci/edmonds_karp_demo.cc
hugo/trunk/src/work/marci/graph_wrapper.h
hugo/trunk/src/work/marci/preflow_demo_athos.cc
hugo/trunk/src/work/marci/preflow_demo_jacint.cc
Log:
marci -> hugo replacements
resize -> update replacements
Modified: hugo/trunk/src/work/alpar/gwrapper.h
==============================================================================
--- hugo/trunk/src/work/alpar/gwrapper.h (original)
+++ hugo/trunk/src/work/alpar/gwrapper.h Fri Feb 20 22:45:07 2004
@@ -2,7 +2,7 @@
#ifndef GRAPH_WRAPPER_H
#define GRAPH_WRAPPER_H
-namespace marci {
+namespace hugo {
template<typename G>
class TrivGraphWrapper
Modified: hugo/trunk/src/work/alpar/smart_graph.h
==============================================================================
--- hugo/trunk/src/work/alpar/smart_graph.h (original)
+++ hugo/trunk/src/work/alpar/smart_graph.h Fri Feb 20 22:45:07 2004
@@ -1,10 +1,12 @@
+// -*- mode:C++ -*-
+
#ifndef SMART_GRAPH_H
#define SMART_GRAPH_H
#include <iostream>
#include <vector>
-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 <typename T> class NodeMap;
- template <typename T> class EdgeMap;
- private:
+ template <typename T> class NodeMap;
+ template <typename T> class EdgeMap;
- template <typename T> friend class NodeMap;
- template <typename T> friend class EdgeMap;
-
- template <typename T>
- class NodeMap {
- const SmartGraph& G;
- std::vector<T> 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 <typename T>
- class EdgeMap {
- const SmartGraph& G;
- std::vector<T> 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<int(edges.size()); }
bool valid(NodeIt n) const { return n.n<int(nodes.size()); }
- template <typename It> It next(It it) const {
- It tmp(it); return goNext(it); }
+ template <typename It> 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 <typename T>
+ class NodeMap {
+ const SmartGraph& G;
+ std::vector<T> 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 <typename T>
+ class EdgeMap {
+ const SmartGraph& G;
+ std::vector<T> 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
Modified: hugo/trunk/src/work/athos/pf_demo.cc
==============================================================================
--- hugo/trunk/src/work/athos/pf_demo.cc (original)
+++ hugo/trunk/src/work/athos/pf_demo.cc Fri Feb 20 22:45:07 2004
@@ -7,7 +7,7 @@
//#include "marci_property_vector.hh"
#include "preflow_push.hh"
-using namespace marci;
+using namespace hugo;
int main (int, char*[])
Modified: hugo/trunk/src/work/athos/preflow_push.hh
==============================================================================
--- hugo/trunk/src/work/athos/preflow_push.hh (original)
+++ hugo/trunk/src/work/athos/preflow_push.hh Fri Feb 20 22:45:07 2004
@@ -12,7 +12,7 @@
using namespace std;
-namespace marci {
+namespace hugo {
template <typename graph_type, typename T>
class preflow_push {
@@ -434,6 +434,6 @@
}//run
-}//namespace marci
+}//namespace hugo
#endif //PREFLOW_PUSH_HH
Modified: hugo/trunk/src/work/athos/reverse_bfs.hh
==============================================================================
--- hugo/trunk/src/work/athos/reverse_bfs.hh (original)
+++ hugo/trunk/src/work/athos/reverse_bfs.hh Fri Feb 20 22:45:07 2004
@@ -96,7 +96,7 @@
};
-} // namespace marci
+} // namespace hugo
#endif //REVERSE_BFS_HH
Modified: hugo/trunk/src/work/bfs_iterator.hh
==============================================================================
--- hugo/trunk/src/work/bfs_iterator.hh (original)
+++ hugo/trunk/src/work/bfs_iterator.hh Fri Feb 20 22:45:07 2004
@@ -6,7 +6,7 @@
#include <utility>
#include <graph_wrapper.h>
-namespace marci {
+namespace hugo {
template <typename Graph>
struct bfs {
@@ -755,6 +755,6 @@
-} // namespace marci
+} // namespace hugo
#endif //BFS_ITERATOR_HH
Modified: hugo/trunk/src/work/bin_heap_demo.cc
==============================================================================
--- hugo/trunk/src/work/bin_heap_demo.cc (original)
+++ hugo/trunk/src/work/bin_heap_demo.cc Fri Feb 20 22:45:07 2004
@@ -3,7 +3,7 @@
#include <string>
#include <map>
-using namespace marci;
+using namespace hugo;
using namespace std;
class string_int_map;
Modified: hugo/trunk/src/work/jacint/dijkstra.hh
==============================================================================
--- hugo/trunk/src/work/jacint/dijkstra.hh (original)
+++ hugo/trunk/src/work/jacint/dijkstra.hh Fri Feb 20 22:45:07 2004
@@ -52,7 +52,7 @@
namespace std {
- namespace marci {
+ namespace hugo {
@@ -185,7 +185,7 @@
- } // namespace marci
+ } // namespace hugo
}
#endif //DIJKSTRA_HH
Modified: hugo/trunk/src/work/jacint/flow_test.cc
==============================================================================
--- hugo/trunk/src/work/jacint/flow_test.cc (original)
+++ hugo/trunk/src/work/jacint/flow_test.cc Fri Feb 20 22:45:07 2004
@@ -8,7 +8,7 @@
#include <reverse_bfs.h>
//#include <dijkstra.h>
-using namespace marci;
+using namespace hugo;
int main (int, char*[])
Modified: hugo/trunk/src/work/jacint/preflow_hl2.h
==============================================================================
--- hugo/trunk/src/work/jacint/preflow_hl2.h (original)
+++ hugo/trunk/src/work/jacint/preflow_hl2.h Fri Feb 20 22:45:07 2004
@@ -41,7 +41,7 @@
#include <stack>
#include <queue>
-namespace marci {
+namespace hugo {
template <typename Graph, typename T,
typename FlowMap=typename Graph::EdgeMap<T>, typename CapMap=typename Graph::EdgeMap<T>,
@@ -396,7 +396,7 @@
};
-}//namespace marci
+}//namespace hugo
#endif
Modified: hugo/trunk/src/work/jacint/preflow_hl3.h
==============================================================================
--- hugo/trunk/src/work/jacint/preflow_hl3.h (original)
+++ hugo/trunk/src/work/jacint/preflow_hl3.h Fri Feb 20 22:45:07 2004
@@ -44,7 +44,7 @@
#include <stack>
#include <queue>
-namespace marci {
+namespace hugo {
template <typename Graph, typename T,
typename FlowMap=typename Graph::EdgeMap<T>, typename CapMap=typename Graph::EdgeMap<T>,
@@ -464,7 +464,7 @@
};
-}//namespace marci
+}//namespace hugo
#endif
Modified: hugo/trunk/src/work/jacint/preflow_hl4.h
==============================================================================
--- hugo/trunk/src/work/jacint/preflow_hl4.h (original)
+++ hugo/trunk/src/work/jacint/preflow_hl4.h Fri Feb 20 22:45:07 2004
@@ -44,7 +44,7 @@
#include <stack>
#include <queue>
-namespace marci {
+namespace hugo {
template <typename Graph, typename T,
typename FlowMap=typename Graph::EdgeMap<T>,
@@ -478,7 +478,7 @@
};
-}//namespace marci
+}//namespace hugo
#endif
Modified: hugo/trunk/src/work/jacint/preflow_push_hl.h
==============================================================================
--- hugo/trunk/src/work/jacint/preflow_push_hl.h (original)
+++ hugo/trunk/src/work/jacint/preflow_push_hl.h Fri Feb 20 22:45:07 2004
@@ -43,7 +43,7 @@
#include <stack>
#include <queue>
-namespace marci {
+namespace hugo {
template <typename Graph, typename T,
typename FlowMap=typename Graph::EdgeMap<T>, typename CapMap=typename Graph::EdgeMap<T>,
@@ -390,7 +390,7 @@
};
-}//namespace marci
+}//namespace hugo
#endif
Modified: hugo/trunk/src/work/jacint/preflow_push_hl.hh
==============================================================================
--- hugo/trunk/src/work/jacint/preflow_push_hl.hh (original)
+++ hugo/trunk/src/work/jacint/preflow_push_hl.hh Fri Feb 20 22:45:07 2004
@@ -32,7 +32,7 @@
#include <marci_property_vector.hh>
#include <reverse_bfs.hh>
-namespace marci {
+namespace hugo {
template <typename graph_type, typename T>
class preflow_push_hl {
@@ -312,7 +312,7 @@
};
-}//namespace marci
+}//namespace hugo
#endif
Modified: hugo/trunk/src/work/jacint/preflow_push_max_flow.h
==============================================================================
--- hugo/trunk/src/work/jacint/preflow_push_max_flow.h (original)
+++ hugo/trunk/src/work/jacint/preflow_push_max_flow.h Fri Feb 20 22:45:07 2004
@@ -33,7 +33,7 @@
#include <reverse_bfs.h>
-namespace marci {
+namespace hugo {
template <typename Graph, typename T,
typename FlowMap=typename Graph::EdgeMap<T>, typename CapMap=typename Graph::EdgeMap<T>,
@@ -287,7 +287,7 @@
};
-}//namespace marci
+}//namespace hugo
#endif
Modified: hugo/trunk/src/work/jacint/preflow_push_max_flow.hh
==============================================================================
--- hugo/trunk/src/work/jacint/preflow_push_max_flow.hh (original)
+++ hugo/trunk/src/work/jacint/preflow_push_max_flow.hh Fri Feb 20 22:45:07 2004
@@ -32,7 +32,7 @@
#include <reverse_bfs.hh>
-namespace marci {
+namespace hugo {
template <typename graph_type, typename T>
class preflow_push_max_flow {
@@ -306,7 +306,7 @@
};
-}//namespace marci
+}//namespace hugo
#endif
Modified: hugo/trunk/src/work/jacint/reverse_bfs.h
==============================================================================
--- hugo/trunk/src/work/jacint/reverse_bfs.h (original)
+++ hugo/trunk/src/work/jacint/reverse_bfs.h Fri Feb 20 22:45:07 2004
@@ -82,7 +82,7 @@
};
-} // namespace marci
+} // namespace hugo
#endif //REVERSE_BFS_HH
Modified: hugo/trunk/src/work/jacint/reverse_bfs.hh
==============================================================================
--- hugo/trunk/src/work/jacint/reverse_bfs.hh (original)
+++ hugo/trunk/src/work/jacint/reverse_bfs.hh Fri Feb 20 22:45:07 2004
@@ -87,7 +87,7 @@
};
-} // namespace marci
+} // namespace hugo
#endif //REVERSE_BFS_HH
Modified: hugo/trunk/src/work/marci/dimacs.hh
==============================================================================
--- hugo/trunk/src/work/marci/dimacs.hh (original)
+++ hugo/trunk/src/work/marci/dimacs.hh Fri Feb 20 22:45:07 2004
@@ -5,7 +5,7 @@
#include <string>
#include <vector>
-namespace marci {
+namespace hugo {
template<typename Graph, typename CapacityMap>
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
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 Fri Feb 20 22:45:07 2004
@@ -6,7 +6,7 @@
#include <edmonds_karp.hh>
#include <time_measure.h>
-using namespace marci;
+using namespace hugo;
// Use a DIMACS max flow file as stdin.
// read_dimacs_demo < dimacs_max_flow_file
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 Fri Feb 20 22:45:07 2004
@@ -2,7 +2,7 @@
#ifndef GRAPH_WRAPPER_H
#define GRAPH_WRAPPER_H
-namespace marci {
+namespace hugo {
template<typename Graph>
class TrivGraphWrapper {
@@ -573,7 +573,7 @@
-} //namespace marci
+} //namespace hugo
#endif //GRAPH_WRAPPER_H
Modified: hugo/trunk/src/work/marci/preflow_demo_athos.cc
==============================================================================
--- hugo/trunk/src/work/marci/preflow_demo_athos.cc (original)
+++ hugo/trunk/src/work/marci/preflow_demo_athos.cc Fri Feb 20 22:45:07 2004
@@ -6,7 +6,7 @@
#include <preflow_push.hh>
#include <time_measure.h>
-using namespace marci;
+using namespace hugo;
// Use a DIMACS max flow file as stdin.
// read_dimacs_demo < dimacs_max_flow_file
Modified: hugo/trunk/src/work/marci/preflow_demo_jacint.cc
==============================================================================
--- hugo/trunk/src/work/marci/preflow_demo_jacint.cc (original)
+++ hugo/trunk/src/work/marci/preflow_demo_jacint.cc Fri Feb 20 22:45:07 2004
@@ -7,7 +7,7 @@
#include <preflow_push_hl.h>
#include <time_measure.h>
-using namespace marci;
+using namespace hugo;
// Use a DIMACS max flow file as stdin.
// read_dimacs_demo < dimacs_max_flow_file
More information about the Lemon-commits
mailing list