Question
c++ program please Suppose that you are searching for an airline flight. You will be interested in the price of the flight, but you will
c++ program please
Suppose that you are searching for an airline flight. You will be interested in the price of the flight, but you will probably also be interested in the amount of time that the flight(s) will take. This program is based on that problem. You will be given a directed graph where each edge has a cost and a duration. Your job will be to find the shortest duration path that doesnt go over a given total cost. The graph will be given as follows. The number of vertices and edges will be on the first line, followed by one edge per line. Each edge will have the two vertices, the cost and the duration, all of which will be positive integers. Note that in this graph there may be multiple edges between any two vertices. Your program should take four command line arguments: the name of the file containing the graph, the start vertex, the end vertex, and the maximum total cost. The output of the program is a single integer, the duration of the cheapest path from the start vertex to the end vertex with total cost less than the limit. If no path exists with cost less than the limit, output a 0. No other output should appear. Hint: for this program, you will want to modify the Bellman-Ford algorithm. Instead of a single weight for each vertex of the graph, you will need to maintain an ordered list based on cost. Example input graph: 5 7 0 1 30 100 0 4 50 125 1 2 250 50 1 2 50 150 4 2 40 100 2 3 60 90 4 3 150 125 Executing project5 graph.txt 0 3 200 Should output 250 Executing project5 graph.txt 0 3 140 Should output 340 Executing project5 graph.txt 0 3 139 Should output 0
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started