On the dimension of a graph