Index: test/graph_test.cc
===================================================================
--- test/graph_test.cc	(revision 334)
+++ test/graph_test.cc	(revision 335)
@@ -127,4 +127,5 @@
 //  { // Checking FullGraph
 //    checkConcept<Graph, FullGraph>();
+//    checkGraphIterators<FullGraph>();
 //  }
   { // Checking GridGraph
@@ -187,74 +188,81 @@
 }
 
-void checkGridGraph(const GridGraph& g, int w, int h) {
-  check(g.width() == w, "Wrong width");
-  check(g.height() == h, "Wrong height");
-
-  for (int i = 0; i < w; ++i) {
-    for (int j = 0; j < h; ++j) {
-      check(g.col(g(i, j)) == i, "Wrong col");
-      check(g.row(g(i, j)) == j, "Wrong row");
-    }
-  }
-
-  for (int i = 0; i < w; ++i) {
-    for (int j = 0; j < h - 1; ++j) {
-      check(g.source(g.down(g(i, j))) == g(i, j), "Wrong down");
-      check(g.target(g.down(g(i, j))) == g(i, j + 1), "Wrong down");
-    }
-    check(g.down(g(i, h - 1)) == INVALID, "Wrong down");
-  }
-
-  for (int i = 0; i < w; ++i) {
-    for (int j = 1; j < h; ++j) {
-      check(g.source(g.up(g(i, j))) == g(i, j), "Wrong up");
-      check(g.target(g.up(g(i, j))) == g(i, j - 1), "Wrong up");
-    }
-    check(g.up(g(i, 0)) == INVALID, "Wrong up");
-  }
-
-  for (int j = 0; j < h; ++j) {
-    for (int i = 0; i < w - 1; ++i) {
-      check(g.source(g.right(g(i, j))) == g(i, j), "Wrong right");
-      check(g.target(g.right(g(i, j))) == g(i + 1, j), "Wrong right");
-    }
-    check(g.right(g(w - 1, j)) == INVALID, "Wrong right");
-  }
-
-  for (int j = 0; j < h; ++j) {
-    for (int i = 1; i < w; ++i) {
-      check(g.source(g.left(g(i, j))) == g(i, j), "Wrong left");
-      check(g.target(g.left(g(i, j))) == g(i - 1, j), "Wrong left");
-    }
-    check(g.left(g(0, j)) == INVALID, "Wrong left");
-  }
-
-  checkGraphNodeList(g, w*h);
-  checkGraphArcList(g, 2*(2*w*h-w-h));
-  checkGraphEdgeList(g, 2*w*h-w-h);
-
-  checkGraphOutArcList(g, g(0,0), 2);
-  checkGraphOutArcList(g, g(0,1), 3);
-  checkGraphOutArcList(g, g(w-2,h-2), 4);
-
-  checkGraphInArcList(g, g(0,0), 2);
-  checkGraphInArcList(g, g(0,1), 3);
-  checkGraphInArcList(g, g(w-2,h-2), 4);
-
-  checkGraphIncEdgeList(g, g(0,0), 2);
-  checkGraphIncEdgeList(g, g(0,1), 3);
-  checkGraphIncEdgeList(g, g(w-2,h-2), 4);
-
-  checkGraphConArcList(g, 2*(2*w*h-w-h));
-  checkGraphConEdgeList(g, 2*w*h-w-h);
-
-  checkArcDirections(g);
-
-  checkNodeIds(g);
-  checkArcIds(g);
-  checkEdgeIds(g);
-  checkGraphNodeMap(g);
-  checkGraphArcMap(g);
-  checkGraphEdgeMap(g);
+void checkGridGraph(int width, int height) {
+  typedef GridGraph Graph;
+  GRAPH_TYPEDEFS(Graph);
+  Graph G(width, height);
+
+  check(G.width() == width, "Wrong row number");
+  check(G.height() == height, "Wrong column number");
+
+  for (int i = 0; i < width; ++i) {
+    for (int j = 0; j < height; ++j) {
+      check(G.col(G(i, j)) == i, "Wrong column");
+      check(G.row(G(i, j)) == j, "Wrong row");
+      check(G.pos(G(i, j)).x == i, "Wrong column");
+      check(G.pos(G(i, j)).y == j, "Wrong row");
+    }
+  }
+
+  for (int j = 0; j < height; ++j) {
+    for (int i = 0; i < width - 1; ++i) {
+      check(G.source(G.right(G(i, j))) == G(i, j), "Wrong right");
+      check(G.target(G.right(G(i, j))) == G(i + 1, j), "Wrong right");
+    }
+    check(G.right(G(width - 1, j)) == INVALID, "Wrong right");
+  }
+
+  for (int j = 0; j < height; ++j) {
+    for (int i = 1; i < width; ++i) {
+      check(G.source(G.left(G(i, j))) == G(i, j), "Wrong left");
+      check(G.target(G.left(G(i, j))) == G(i - 1, j), "Wrong left");
+    }
+    check(G.left(G(0, j)) == INVALID, "Wrong left");
+  }
+
+  for (int i = 0; i < width; ++i) {
+    for (int j = 0; j < height - 1; ++j) {
+      check(G.source(G.up(G(i, j))) == G(i, j), "Wrong up");
+      check(G.target(G.up(G(i, j))) == G(i, j + 1), "Wrong up");
+    }
+    check(G.up(G(i, height - 1)) == INVALID, "Wrong up");
+  }
+
+  for (int i = 0; i < width; ++i) {
+    for (int j = 1; j < height; ++j) {
+      check(G.source(G.down(G(i, j))) == G(i, j), "Wrong down");
+      check(G.target(G.down(G(i, j))) == G(i, j - 1), "Wrong down");
+    }
+    check(G.down(G(i, 0)) == INVALID, "Wrong down");
+  }
+
+  checkGraphNodeList(G, width * height);
+  checkGraphEdgeList(G, width * (height - 1) + (width - 1) * height);
+  checkGraphArcList(G, 2 * (width * (height - 1) + (width - 1) * height));
+
+  for (NodeIt n(G); n != INVALID; ++n) {
+    int nb = 4;
+    if (G.col(n) == 0) --nb;
+    if (G.col(n) == width - 1) --nb;
+    if (G.row(n) == 0) --nb;
+    if (G.row(n) == height - 1) --nb;
+
+    checkGraphOutArcList(G, n, nb);
+    checkGraphInArcList(G, n, nb);
+    checkGraphIncEdgeList(G, n, nb);
+  }
+
+  checkArcDirections(G);
+
+  checkGraphConArcList(G, 2 * (width * (height - 1) + (width - 1) * height));
+  checkGraphConEdgeList(G, width * (height - 1) + (width - 1) * height);
+
+  checkNodeIds(G);
+  checkArcIds(G);
+  checkEdgeIds(G);
+  checkGraphNodeMap(G);
+  checkGraphArcMap(G);
+  checkGraphEdgeMap(G);
+
 }
 
@@ -274,6 +282,9 @@
 //   }
   { // Checking GridGraph
-    GridGraph g(5, 6);
-    checkGridGraph(g, 5, 6);
+    checkGridGraph(5, 8);
+    checkGridGraph(8, 5);
+    checkGridGraph(5, 5);
+    checkGridGraph(0, 0);
+    checkGridGraph(1, 1);
   }
 }
