#include <lemon/grid_graph.h>
(i,j) value where i
is in the
[0,height) range and j is in the [0, width) 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:
GridGraph graph(h, w); GridGraph::NodeMap<int> val(graph); for (int i = 0; i < graph.height(); ++i) { for (int j = 0; j < graph.width(); ++j) { val[graph(i, j)] = i + j; } }
The graph type is fully conform to the Undirected Graph concept.