Changes in doc.
4 @defgroup paths Path Structures
6 \brief Path structures implemented in Hugo.
8 Hugolib provides flexible data structures
11 All of them have the same interface, especially they can be built or extended
12 using a standard Builder subclass. This make is easy to have e.g. the Dijkstra
13 algorithm to store its result in any kind of path structure.
19 ///\brief Classes for representing paths in graphs.
28 #include <hugo/invalid.h>
29 #include <hugo/error.h>
34 /// \addtogroup skeletons
38 //! \brief A structure for representing directed path in a graph.
40 //! A structure for representing directed path in a graph.
41 //! \param GR The graph type in which the path is.
43 //! In a sense, the path can be treated as a graph, for is has \c NodeIt
44 //! and \c EdgeIt with the same usage. These types converts to the \c Node
45 //! and \c Edge of the original graph.
50 /// Type of the underlying graph.
51 typedef typename GR Graph;
52 /// Edge type of the underlying graph.
53 typedef typename Graph::Edge GraphEdge;
54 /// Node type of the underlying graph.
55 typedef typename Graph::Node GraphNode;
59 /// \param _G The graph in which the path is.
61 Path(const Graph &_G) {}
63 /// Length of the path.
64 size_t length() const {}
65 /// Returns whether the path is empty.
68 /// Resets the path to an empty path.
71 /// \brief Starting point of the path.
73 /// Starting point of the path.
74 /// Returns INVALID if the path is empty.
75 NodeIt head() const {}
76 /// \brief End point of the path.
78 /// End point of the path.
79 /// Returns INVALID if the path is empty.
80 NodeIt tail() const {}
82 /// \brief First NodeIt/EdgeIt.
84 /// Initializes node or edge iterator to point to the first
87 It& first(It &i) const { return i=It(*this); }
89 /// \brief The head of an edge.
91 /// Returns node iterator pointing to the head node of the
92 /// given edge iterator.
93 NodeIt head(const EdgeIt& e) const {}
95 /// \brief The tail of an edge.
97 /// Returns node iterator pointing to the tail node of the
98 /// given edge iterator.
99 NodeIt tail(const EdgeIt& e) const {}
102 /* Iterator classes */
105 * \brief Iterator class to iterate on the edges of the paths
108 * This class is used to iterate on the edges of the paths
110 * Of course it converts to Graph::Edge
115 /// Default constructor
117 /// Invalid constructor
119 /// Constructor with starting point
120 EdgeIt(const Path &_p) {}
122 operator GraphEdge () const {}
125 EdgeIt& operator++() {}
127 /// Comparison operator
128 bool operator==(const EdgeIt& e) const {}
129 /// Comparison operator
130 bool operator!=(const EdgeIt& e) const {}
131 // /// Comparison operator
132 // /// \todo It is not clear what is the "natural" ordering.
133 // bool operator<(const EdgeIt& e) const {}
138 * \brief Iterator class to iterate on the nodes of the paths
141 * This class is used to iterate on the nodes of the paths
143 * Of course it converts to Graph::Node.
148 /// Default constructor
150 /// Invalid constructor
152 /// Constructor with starting point
153 NodeIt(const Path &_p) {}
155 ///Conversion to Graph::Node
156 operator const GraphNode& () const {}
158 NodeIt& operator++() {}
160 /// Comparison operator
161 bool operator==(const NodeIt& e) const {}
162 /// Comparison operator
163 bool operator!=(const NodeIt& e) const {}
164 // /// Comparison operator
165 // /// \todo It is not clear what is the "natural" ordering.
166 // bool operator<(const NodeIt& e) const {}
170 friend class Builder;
173 * \brief Class to build paths
176 * This class is used to fill a path with edges.
178 * You can push new edges to the front and to the back of the path in
179 * arbitrary order then you should commit these changes to the graph.
181 * While the builder is active (after the first modifying
182 * operation and until the call of \ref commit())
183 * the underlining Path is in a
184 * "transitional" state (operations on it have undefined result).
188 ///\param _P the path you want to fill in.
190 Builder(Path &_P) : P(_P) {}
192 /// Sets the starting node of the path.
194 /// Sets the starting node of the path. Edge added to the path
195 /// afterwards have to be incident to this node.
196 /// You \em must start building an empry path with this functions.
197 /// (And you \em must \em not use it later).
200 void setStartNode(const GraphNode &) {}
202 ///Push a new edge to the front of the path
204 ///Push a new edge to the front of the path.
205 ///If the path is empty, you \em must call \ref setStartNode() before
206 ///the first use of \ref pushFront().
207 void pushFront(const GraphEdge& e) {}
209 ///Push a new edge to the back of the path
211 ///Push a new edge to the back of the path.
212 ///If the path is empty, you \em must call \ref setStartNode() before
213 ///the first use of \ref pushBack().
214 void pushBack(const GraphEdge& e) {}
216 ///Commit the changes to the path.
219 ///Reserve (front) storage for the builder in advance.
221 ///If you know an reasonable upper bound of the number of the edges
222 ///to add to the front of the path,
223 ///using this function you may speed up the building.
224 void reserveFront(size_t r) {}
225 ///Reserve (back) storage for the builder in advance.
227 ///If you know an reasonable upper bound of the number of the edges
228 ///to add to the back of the path,
229 ///using this function you may speed up the building.
230 void reserveBack(size_t r) {}
239 #endif // HUGO_PATH_H