'grid_graph([n,m]) is a connected simple graph with the
following properties:
number_of_nodes = n*m
degree_histogram = [0,0,4,2*(n+m)-8,(n-2)*(m-2)]'

def test_grid_graph(self):

    for (n, m) in [(3, 5), (5, 3), (4, 5), (5, 4)]:
        dim = [n, m]
        g = nx.grid_graph(dim)
        assert_equal(len(g), (n * m))
        assert_equal(nx.degree_histogram(g), [0, 0, 4, ((2 * (n + m)) - 8), ((n - 2) * (m - 2))])
    for (n, m) in [(1, 5), (5, 1)]:
        dim = [n, m]
        g = nx.grid_graph(dim)
        assert_equal(len(g), (n * m))
        assert_true(nx.is_isomorphic(g, nx.path_graph(5)))
