Making a grid graph?

I have a question. How would I go about making a graph that's based on a grid type format?
I need to make this into a weighted graph. I'm aware how to make weighted graphs, as I have done so before. But how would I make this into a grid format. Ignoring the 1.0's of course. so .01 would be vertex [1][1]. That way i could have the shortest path from say [1][1] to [6][3] or something like that. The weight from each to each is the numbers there. So from [1][1] to [1][2] would be a weight of .01. Any help is appreciated, sort of lost here :p
1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0
1.0 .01 .01 .01 .01 .50 .25 .25 1.0
1.0 .50 .50 .05 .50 .10 .10 .50 1.0
1.0 .25 .10 .15 .35 .50 .15 .15 1.0
1.0 .10 .10 .50 .85 .01 .01 .01 1.0
1.0 .50 .15 .15 .35 .25 .10 .15 1.0
1.0 .01 .01 .01 .01 .50 .15 .15 1.0
1.0 .50 .50 .05 .01 .85 .01 .01 1.0
1.0 .25 .10 .15 .85 .10 .50 .85 1.0
1.0 .10 .10 .50 .85 .10 .25 .15 1.0
1.0 .50 .15 .15 .15 .10 .50 .01 1.0
1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0
I could be completely off here... probably because I'm tunneled in my own program (Programming Level: Zombie state), but if you're looking for the shortest path, maybe try Dijkstra's algorithm. If you're not familiar w/the concept, or just need brushing up to make sense of implemented code, I'd recommend this YouTube video. Helped me out a lot in my Discrete Math class. Hope that helps...

http://www.youtube.com/watch?v=xT5o1QCeWS8



Topic archived. No new replies allowed.