How to convert grid into graph because I have to apply bfs to solve the problem?

I have been given a grid in which elements are numbered from 1 to m*n(size of grid). and asked to find shorted path from ith element to all of its 4 corner elements. also We have been given direction(out of 8 including diagonals) which are available to move from any jth element in grid.
I am thinking to convert this grid into graph/adjancy list so that I can apply bfs to find shortest path.

Please tell me how to convert grid into graph?