(i,j) value where i is in the [0,width) range and j is in the [0, height) range. Two nodes are connected in the graph if the indices differ only on one position and only one is the difference.
The graph can be indiced in the following way:
GridUGraph graph(w, h); GridUGraph::NodeMap<int> val(graph); for (int i = 0; i < graph.width(); ++i) { for (int j = 0; j < graph.height(); ++j) { val[graph(i, j)] = i + j; } }
The graph type is fully conform to the Undirected Graph concept, and it also has an important extra feature that its maps are real reference maps.
#include <lemon/grid_ugraph.h>

Classes | |
| class | ColMap |
| class | IndexMap |
| class | RowMap |
Public Member Functions | |
| GridUGraph (int n, int m) | |
| Constructor. | |
| void | resize (int n, int m) |
| Resize the graph. | |
| Node | operator() (int i, int j) const |
| The node on the given position. | |
| int | row (Node n) const |
| int | col (Node n) const |
| int | width () const |
| int | height () const |
| Edge | down (Node n) const |
| Gives back the edge goes down from the node. | |
| Edge | up (Node n) const |
| Gives back the edge goes up from the node. | |
| Edge | right (Node n) const |
| Gives back the edge goes right from the node. | |
| Edge | left (Node n) const |
| Gives back the edge goes left from the node. | |
| GridUGraph | ( | int | n, | |
| int | m | |||
| ) | [inline] |
| Node operator() | ( | int | i, | |
| int | j | |||
| ) | const [inline] |
Gives back the node on the given position.
| int row | ( | Node | n | ) | const [inline] |
Gives back the row index of the node.
| int col | ( | Node | n | ) | const [inline] |
Gives back the coloumn index of the node.
| int width | ( | ) | const [inline] |
Gives back the width of the graph.
| int height | ( | ) | const [inline] |
Gives back the height of the graph.
| Edge down | ( | Node | n | ) | const [inline] |
Gives back the edge goes down from the node. If there is not outgoing edge then it gives back INVALID.
| Edge up | ( | Node | n | ) | const [inline] |
Gives back the edge goes up from the node. If there is not outgoing edge then it gives back INVALID.
| Edge right | ( | Node | n | ) | const [inline] |
Gives back the edge goes right from the node. If there is not outgoing edge then it gives back INVALID.
| Edge left | ( | Node | n | ) | const [inline] |
Gives back the edge goes left from the node. If there is not outgoing edge then it gives back INVALID.
1.5.9