equal
deleted
inserted
replaced
19 |
19 |
20 #include <iostream> |
20 #include <iostream> |
21 #include <vector> |
21 #include <vector> |
22 #include <lemon/invalid.h> |
22 #include <lemon/invalid.h> |
23 #include <lemon/utility.h> |
23 #include <lemon/utility.h> |
|
24 #include <lemon/error.h> |
24 |
25 |
25 #include <lemon/bits/iterable_graph_extender.h> |
26 #include <lemon/bits/iterable_graph_extender.h> |
26 #include <lemon/bits/alteration_notifier.h> |
27 #include <lemon/bits/alteration_notifier.h> |
27 #include <lemon/bits/default_map.h> |
28 #include <lemon/bits/default_map.h> |
|
29 #include <lemon/bits/graph_extender.h> |
28 |
30 |
29 ///\ingroup graphs |
31 ///\ingroup graphs |
30 ///\file |
32 ///\file |
31 ///\brief HyperCubeGraph class. |
33 ///\brief HyperCubeGraph class. |
32 |
34 |
33 namespace lemon { |
35 namespace lemon { |
34 |
36 |
35 /// \brief Base graph for HyperGraph. |
37 /// \brief Base graph for HyperCubeGraph. |
36 /// |
38 /// |
37 /// Base graph for hyper-cube graph. It describes some member functions |
39 /// Base graph for hyper-cube graph. It describes some member functions |
38 /// which can be used in the HyperCubeGraph. |
40 /// which can be used in the HyperCubeGraph. |
39 /// |
41 /// |
40 /// \warning Always use the HyperCubeGraph instead of this. |
42 /// \warning Always use the HyperCubeGraph instead of this. |
75 |
77 |
76 /// Maximum node ID. |
78 /// Maximum node ID. |
77 |
79 |
78 /// Maximum node ID. |
80 /// Maximum node ID. |
79 ///\sa id(Node) |
81 ///\sa id(Node) |
80 int maxId(Node = INVALID) const { return nodeNum() - 1; } |
82 int maxNodeId() const { return nodeNum() - 1; } |
81 /// Maximum edge ID. |
83 /// Maximum edge ID. |
82 |
84 |
83 /// Maximum edge ID. |
85 /// Maximum edge ID. |
84 ///\sa id(Edge) |
86 ///\sa id(Edge) |
85 int maxId(Edge = INVALID) const { return edgeNum() - 1; } |
87 int maxEdgeId() const { return edgeNum() - 1; } |
86 |
88 |
87 /// \brief Gives back the source node of an edge. |
89 /// \brief Gives back the source node of an edge. |
88 /// |
90 /// |
89 /// Gives back the source node of an edge. |
91 /// Gives back the source node of an edge. |
90 Node source(Edge e) const { |
92 Node source(Edge e) const { |
116 /// |
118 /// |
117 /// The ID of the \ref INVALID edge is -1. |
119 /// The ID of the \ref INVALID edge is -1. |
118 ///\return The ID of the edge \c e. |
120 ///\return The ID of the edge \c e. |
119 static int id(Edge e) { return e.id; } |
121 static int id(Edge e) { return e.id; } |
120 |
122 |
121 static Node fromId(int id, Node) { return Node(id);} |
123 static Node nodeFromId(int id) { return Node(id);} |
122 |
124 |
123 static Edge fromId(int id, Edge) { return Edge(id);} |
125 static Edge edgeFromId(int id) { return Edge(id);} |
124 |
126 |
125 class Node { |
127 class Node { |
126 friend class HyperCubeGraphBase; |
128 friend class HyperCubeGraphBase; |
127 |
129 |
128 protected: |
130 protected: |
233 |
235 |
234 |
236 |
235 typedef StaticMappableGraphExtender< |
237 typedef StaticMappableGraphExtender< |
236 IterableGraphExtender< |
238 IterableGraphExtender< |
237 AlterableGraphExtender< |
239 AlterableGraphExtender< |
238 HyperCubeGraphBase > > > ExtendedHyperCubeGraphBase; |
240 GraphExtender< |
|
241 HyperCubeGraphBase> > > > ExtendedHyperCubeGraphBase; |
239 |
242 |
240 /// \ingroup graphs |
243 /// \ingroup graphs |
241 /// |
244 /// |
242 /// \brief HyperCube graph class |
245 /// \brief HyperCube graph class |
243 /// |
246 /// |
305 /// where the node's index is one. |
308 /// where the node's index is one. |
306 template <typename It> |
309 template <typename It> |
307 HyperMap(const Graph& graph, It begin, It end, |
310 HyperMap(const Graph& graph, It begin, It end, |
308 T fv = 0.0, const BF& bf = BF()) |
311 T fv = 0.0, const BF& bf = BF()) |
309 : _graph(graph), _values(begin, end), _first_value(fv), _bin_func(bf) { |
312 : _graph(graph), _values(begin, end), _first_value(fv), _bin_func(bf) { |
310 if (_values.size() != graph.dimension()) {} |
313 LEMON_ASSERT(_values.size() != graph.dimension(), |
|
314 "Wrong size of dimension"); |
311 } |
315 } |
312 |
316 |
313 /// \brief Gives back the partial accumulated value. |
317 /// \brief Gives back the partial accumulated value. |
314 /// |
318 /// |
315 /// Gives back the partial accumulated value. |
319 /// Gives back the partial accumulated value. |