I have to do an assignment to find the shortest path between two nodes using Dijkstra's algorithm. I'm confused as to how I should read in and process the input file:
1 2 3 4 5 6 7 8 9 10 11
A B 1
A D 3
A E 9
B C 5
B A 7
C E 1
C A 5
D C 2
D E 6
E B 4
Q
I'm able to use the Standard Template Library with vectors, priority queues, maps, etc.
The implementations of Dijkstra that I've seen online involve inputting the name of the source node only once, and then inputting the destinations with the distances/costs. For example, I could use a priority queue like this:
Would a good method for getting the data from this file involve taking the first character of the first line as the name of the first node, and then, if the first character of the next line is the same, ignore it, and input the rest of the data on that line as a destination with distance/cost? If so, how could I go about doing this?