I want like to print the grid graph like this.

[![enter image description here](https://i.stack.imgur.com/dtvx2.png)](https://i.stack.imgur.com/dtvx2.png)

I tried the following code

```
#include <boost/graph/graphviz.hpp>
#include <boost/graph/grid_graph.hpp>
typedef boost::grid_graph<2> Grid;
int main()
{
    boost::array<std::size_t, 2> lengths = { { 3, 5 } };
    Grid grid(lengths);
    std::ofstream gout;
    gout.open("test.dot");
    boost::write_graphviz(gout, grid);

}

```

and got output like this.

[![enter image description here](https://i.stack.imgur.com/c26ah.png)](https://i.stack.imgur.com/c26ah.png)