
On 11/05/2011 23:40, Fletcher Foti wrote:
Now my problem is that I have to do this search many, many times - performance is very important - and I don't want to initialize the values for a half a million nodes when I'm only going to visit 20. I therefore want to use a std::map to store distances, and I want a key missing from that map to indicate an unvisited node, right? Another option would be to use a combination of a vector and a list of visited nodes. Initialize the full vector only once, and for every search re-initialize those nodes in the list and clear the list. The list can be made using the Visitor that you already use to escape the algorithm.
The advantage is that the algorithm will find its values in a vector which is faster than a map. (AFAIK) -- Alex