Grid Solving Help

I have to find shortest path in a grid having obstacles to a known destination on a grid.
i want to use Dijkstra’s algorithm for finding path. I have stored the node values in a 2D matrix.
eg.

{
       0,0,*,0,*,D;
       0,*,0,0,0,*;
       0,*,0,*,0,0;
       *,*,0,0,*,*;
       0,0,*,*,0,0;
       S,0,0,0,0,0;
}

here * is an obstacle
D is destination
S is Source

plzzz help…

Hello.

I’m not sure what level of help you are looking for, but your “please help” request is really broad. Can you narrow things down by asking more specific questions? I’m happy to help you understand things better, but I’m not willing to write your program for you.

- Ben

To use Dijkstra’s algorithm i want to assign each node a weight. I am Not able to figure out the formula for it given my destination co-ordinates. ?