I have two arrays, one is a node-node-cost array [a_node,b_node,cost] which has 8000 entries and the other one is an association of node with coordinates [node,x,y] which has around 8000 entries as well. Is it better to have a static array of these two or is it better to store these in the database and from that create an array as of performance issue?
These two array will be used to run the shortest path algorithm.
It sounds like you’ll probably want to use a dynamic programming solution where you calculate a small portion of the problem on each iteration and store the intermediate results which will allow you to calculate the shortest path once you are done with all of the intermediate calculations.
I would suggest storing all of your information in a database and selecting out a subset of records (maybe 100 at a time?). Calculate the intermediate information for each node and store that back to the database. If you are going to reuse this path information thousands or millions of times, you don’t want to be recalculating it constantly. You’ll only want to recalculate when the graph changes.
My preferred shortest path algorithm is http://en.wikipedia.org/wiki/Dijkstra‘s_algorithm and it lends itself to an efficient dynamic programming solution.