c++ - Finding connections in 3 vectors of string -


i have written in c++ code, finds shortest path between 2 cities connected roads or flights. cities can connected direct flights or indirect ones. user can type flights this:

aaa aag 300 aaa aab 1 aaa aag 298 aab aac 1 aab aag 297 aac aad 1 aac aag 296 aad aae 1 aad aag 295 aae aaf 1 aae aag 294 aaf aag 1 

where first string leaving city, second destination , number flight time. store these values in 3 vectors:

   vector<string> leavingcities;    vector<string> destcities;    vector<int> flighttimes; 

i have trouble finding indirect flights in these vectors - mean direct flight time aaa aag bigger indirect flight through aab, aac, aad, aae , aaf, , have choose shorter route , store cities travelled by. there solution find shortest time , route? flight list can vary , doesn't have this. maybe there's better container store data this? please, me.

use dijkstra's algorithm find shortest route.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -