# HG changeset patch
# User Peter Kovacs <kpeter@inf.elte.hu>
# Date 1220214586 -7200
# Node ID 0549a6719af981be5c8d16850a49401ade0122eb
# Parent 9654fcabeb820b1c205c396ff24d269d0373eddd
Rename HyperCubeDigraph to HypercubeDigraph (ticket #57)
diff -r 9654fcabeb82 -r 0549a6719af9 lemon/hypercube_graph.h
|
a
|
b
|
|
| 29 | 29 | |
| 30 | 30 | ///\ingroup graphs |
| 31 | 31 | ///\file |
| 32 | | ///\brief HyperCubeDigraph class. |
| | 32 | ///\brief HypercubeDigraph class. |
| 33 | 33 | |
| 34 | 34 | namespace lemon { |
| 35 | 35 | |
| 36 | | class HyperCubeDigraphBase { |
| | 36 | class HypercubeDigraphBase { |
| 37 | 37 | |
| 38 | 38 | public: |
| 39 | 39 | |
| 40 | | typedef HyperCubeDigraphBase Digraph; |
| | 40 | typedef HypercubeDigraphBase Digraph; |
| 41 | 41 | |
| 42 | 42 | class Node; |
| 43 | 43 | class Arc; |
| 44 | 44 | |
| 45 | 45 | public: |
| 46 | 46 | |
| 47 | | HyperCubeDigraphBase() {} |
| | 47 | HypercubeDigraphBase() {} |
| 48 | 48 | |
| 49 | 49 | protected: |
| 50 | 50 | |
| … |
… |
|
| 80 | 80 | static Arc arcFromId(int id) { return Arc(id); } |
| 81 | 81 | |
| 82 | 82 | class Node { |
| 83 | | friend class HyperCubeDigraphBase; |
| | 83 | friend class HypercubeDigraphBase; |
| 84 | 84 | protected: |
| 85 | 85 | int id; |
| 86 | 86 | Node(int _id) { id = _id;} |
| … |
… |
|
| 93 | 93 | }; |
| 94 | 94 | |
| 95 | 95 | class Arc { |
| 96 | | friend class HyperCubeDigraphBase; |
| | 96 | friend class HypercubeDigraphBase; |
| 97 | 97 | protected: |
| 98 | 98 | int id; |
| 99 | 99 | Arc(int _id) : id(_id) {} |
| … |
… |
|
| 168 | 168 | }; |
| 169 | 169 | |
| 170 | 170 | |
| 171 | | typedef DigraphExtender<HyperCubeDigraphBase> ExtendedHyperCubeDigraphBase; |
| | 171 | typedef DigraphExtender<HypercubeDigraphBase> ExtendedHypercubeDigraphBase; |
| 172 | 172 | |
| 173 | 173 | /// \ingroup digraphs |
| 174 | 174 | /// |
| … |
… |
|
| 184 | 184 | /// |
| 185 | 185 | /// The digraph type is fully conform to the \ref concepts::Digraph |
| 186 | 186 | /// concept but it does not conform to \ref concepts::Graph. |
| 187 | | class HyperCubeDigraph : public ExtendedHyperCubeDigraphBase { |
| | 187 | class HypercubeDigraph : public ExtendedHypercubeDigraphBase { |
| 188 | 188 | public: |
| 189 | 189 | |
| 190 | | typedef ExtendedHyperCubeDigraphBase Parent; |
| | 190 | typedef ExtendedHypercubeDigraphBase Parent; |
| 191 | 191 | |
| 192 | 192 | /// \brief Construct a hypercube digraph with \c dim dimension. |
| 193 | 193 | /// |
| 194 | 194 | /// Construct a hypercube digraph with \c dim dimension. |
| 195 | | HyperCubeDigraph(int dim) { construct(dim); } |
| | 195 | HypercubeDigraph(int dim) { construct(dim); } |
| 196 | 196 | |
| 197 | 197 | /// \brief Gives back the number of the dimensions. |
| 198 | 198 | /// |
| … |
… |
|
| 248 | 248 | /// |
| 249 | 249 | ///\code |
| 250 | 250 | /// const int DIM = 3; |
| 251 | | /// HyperCubeDigraph digraph(DIM); |
| | 251 | /// HypercubeDigraph digraph(DIM); |
| 252 | 252 | /// dim2::Point<double> base[DIM]; |
| 253 | 253 | /// for (int k = 0; k < DIM; ++k) { |
| 254 | 254 | /// base[k].x = rnd(); |
| 255 | 255 | /// base[k].y = rnd(); |
| 256 | 256 | /// } |
| 257 | | /// HyperCubeDigraph::HyperMap<dim2::Point<double> > |
| | 257 | /// HypercubeDigraph::HyperMap<dim2::Point<double> > |
| 258 | 258 | /// pos(digraph, base, base + DIM, dim2::Point<double>(0.0, 0.0)); |
| 259 | 259 | ///\endcode |
| 260 | 260 | /// |
| 261 | | /// \see HyperCubeDigraph |
| | 261 | /// \see HypercubeDigraph |
| 262 | 262 | template <typename T, typename BF = std::plus<T> > |
| 263 | 263 | class HyperMap { |
| 264 | 264 | public: |
diff -r 9654fcabeb82 -r 0549a6719af9 test/digraph_test.cc
|
a
|
b
|
|
| 78 | 78 | checkGraphArcMap(G); |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | | void checkHyperCubeDigraph() { |
| 82 | | DIGRAPH_TYPEDEFS(HyperCubeDigraph); |
| | 81 | void checkHypercubeDigraph() { |
| | 82 | DIGRAPH_TYPEDEFS(HypercubeDigraph); |
| 83 | 83 | |
| 84 | 84 | for (int dim = 1; dim < 5; ++dim) { |
| 85 | | HyperCubeDigraph G(dim); |
| | 85 | HypercubeDigraph G(dim); |
| 86 | 86 | checkGraphNodeList(G, 1 << dim); |
| 87 | 87 | checkGraphArcList(G, (1 << dim) * dim); |
| 88 | 88 | |
| … |
… |
|
| 141 | 141 | // { // Checking FullDigraph |
| 142 | 142 | // checkConcept<Digraph, FullDigraph>(); |
| 143 | 143 | // } |
| 144 | | { // Checking HyperCubeDigraph |
| 145 | | checkConcept<Digraph, HyperCubeDigraph>(); |
| | 144 | { // Checking HypercubeDigraph |
| | 145 | checkConcept<Digraph, HypercubeDigraph>(); |
| 146 | 146 | } |
| 147 | 147 | } |
| 148 | 148 | |
| … |
… |
|
| 208 | 208 | // { // Checking FullDigraph |
| 209 | 209 | // checkFullDigraph(); |
| 210 | 210 | // } |
| 211 | | { // Checking HyperCubeDigraph |
| 212 | | checkHyperCubeDigraph(); |
| | 211 | { // Checking HypercubeDigraph |
| | 212 | checkHypercubeDigraph(); |
| 213 | 213 | } |
| 214 | 214 | } |
| 215 | 215 | |