equal
deleted
inserted
replaced
22 #include <lemon/utility.h> |
22 #include <lemon/utility.h> |
23 |
23 |
24 #include <lemon/bits/iterable_graph_extender.h> |
24 #include <lemon/bits/iterable_graph_extender.h> |
25 #include <lemon/bits/alteration_notifier.h> |
25 #include <lemon/bits/alteration_notifier.h> |
26 #include <lemon/bits/static_map.h> |
26 #include <lemon/bits/static_map.h> |
27 |
27 #include <lemon/bits/graph_extender.h> |
28 #include <lemon/bits/undir_graph_extender.h> |
|
29 |
28 |
30 #include <lemon/xy.h> |
29 #include <lemon/xy.h> |
31 |
30 |
32 ///\ingroup graphs |
31 ///\ingroup graphs |
33 ///\file |
32 ///\file |
162 |
161 |
163 /// Maximum node ID. |
162 /// Maximum node ID. |
164 |
163 |
165 /// Maximum node ID. |
164 /// Maximum node ID. |
166 ///\sa id(Node) |
165 ///\sa id(Node) |
167 int maxId(Node = INVALID) const { return nodeNum() - 1; } |
166 int maxNodeId() const { return nodeNum() - 1; } |
168 /// Maximum edge ID. |
167 /// Maximum edge ID. |
169 |
168 |
170 /// Maximum edge ID. |
169 /// Maximum edge ID. |
171 ///\sa id(Edge) |
170 ///\sa id(Edge) |
172 int maxId(Edge = INVALID) const { return edgeNum() - 1; } |
171 int maxEdgeId() const { return edgeNum() - 1; } |
173 |
172 |
174 /// \brief Gives back the source node of an edge. |
173 /// \brief Gives back the source node of an edge. |
175 /// |
174 /// |
176 /// Gives back the source node of an edge. |
175 /// Gives back the source node of an edge. |
177 Node source(Edge e) const { |
176 Node source(Edge e) const { |
213 /// |
212 /// |
214 /// The ID of the \ref INVALID edge is -1. |
213 /// The ID of the \ref INVALID edge is -1. |
215 ///\return The ID of the edge \c e. |
214 ///\return The ID of the edge \c e. |
216 static int id(Edge e) { return e.id; } |
215 static int id(Edge e) { return e.id; } |
217 |
216 |
218 static Node fromId(int id, Node) { return Node(id);} |
217 static Node nodeFromId(int id) { return Node(id);} |
219 |
218 |
220 static Edge fromId(int id, Edge) { return Edge(id);} |
219 static Edge edgeFromId(int id) { return Edge(id);} |
221 |
220 |
222 typedef True FindEdgeTag; |
221 typedef True FindEdgeTag; |
223 |
222 |
224 /// Finds an edge between two nodes. |
223 /// Finds an edge between two nodes. |
225 |
224 |
356 /// |
355 /// |
357 /// The graph can be indiced in the following way: |
356 /// The graph can be indiced in the following way: |
358 /// \code |
357 /// \code |
359 /// GridGraph graph(h, w); |
358 /// GridGraph graph(h, w); |
360 /// GridGraph::NodeMap<int> val(graph); |
359 /// GridGraph::NodeMap<int> val(graph); |
361 /// for (int i = 0; i < graph.height(); ++i) { |
360 /// for (int i = 0; i < graph.width(); ++i) { |
362 /// for (int j = 0; j < graph.width(); ++j) { |
361 /// for (int j = 0; j < graph.height(); ++j) { |
363 /// val[graph(i, j)] = i + j; |
362 /// val[graph(i, j)] = i + j; |
364 /// } |
363 /// } |
365 /// } |
364 /// } |
366 /// \endcode |
365 /// \endcode |
367 /// |
366 /// |
501 return GridGraph::IndexMap(graph); |
500 return GridGraph::IndexMap(graph); |
502 } |
501 } |
503 |
502 |
504 /// \brief Row map of the grid graph |
503 /// \brief Row map of the grid graph |
505 /// |
504 /// |
506 /// Just returns an RowMap for the grid graph. |
505 /// Just returns a RowMap for the grid graph. |
507 GridGraph::RowMap rowMap(const GridGraph& graph) { |
506 GridGraph::RowMap rowMap(const GridGraph& graph) { |
508 return GridGraph::RowMap(graph); |
507 return GridGraph::RowMap(graph); |
509 } |
508 } |
510 |
509 |
511 /// \brief Coloumn map of the grid graph |
510 /// \brief Column map of the grid graph |
512 /// |
511 /// |
513 /// Just returns an ColMap for the grid graph. |
512 /// Just returns a ColMap for the grid graph. |
514 GridGraph::ColMap colMap(const GridGraph& graph) { |
513 GridGraph::ColMap colMap(const GridGraph& graph) { |
515 return GridGraph::ColMap(graph); |
514 return GridGraph::ColMap(graph); |
516 } |
515 } |
517 } |
516 } |
518 #endif |
517 #endif |