Click to See Complete Forum and Search --> : Least Cost to travel from node to node


qiubg
March 5th, 2008, 08:37 PM
There are many nodes in the map, each of which is connected to other nodes. One way traffic for all edges, for instance, from N1 to either N2 or N3, but from N2 or N3 can’t directly go back to N1. One node can go to maximum two other nodes, and mamimum two nodes can go to the same node. The distance between any connection nodes, for instance, S1 (btw N1&N2), S2 (btw N1&N3), etc... is also important. Each node has its weight. Cost=distance*weight. For instance, from N1 to N2, the travelling cost=S1* weight of N2. There is no node that only has in or out path. (there is no starting or ending nodes). The problem is to find the least cost from any node to another node.

I think I can pair the distance with node ID (say, (S1, N2), (S5, N6), etc...) but how to map the nodes? What kind of data structure you think I should use in C++? Or anyone can provide code for this? Appreciated very much.

Ejaz
March 6th, 2008, 12:30 AM
[ Moved Thread ]

qiubg
March 10th, 2008, 01:10 AM
What do you mean?

Ejaz
March 10th, 2008, 01:17 AM
What do you mean?

This mean that your question is more suitable to this board in which it has been moved. Visual C++ is specific to MFC and Visual C++ related issues, whereas, for algorithms & data structures, we have a dedicated place (which is this board).