You are given the information about the flight network between various cities as a graph G = (V, E): the vertex set V is the set of cities and there is an edge between two cities u, v if there is a direct flight between the two cities. Your goal now is to

computer science

Description

You are given the information about the flight network between various cities as a graph G = (V, E): the vertex set V is the set of cities and there is an edge between two cities u, v if there is a direct flight between the two cities. Your goal now is to determine the worst-case number of stops (or connecting flights) a person needs to make to travel between two different cities. For example, if V = {LA, Chicago, NY C, SF, London} and E = {{LA, Chicago}, {Chicago, NY C}, {LA, NY C}, {SF, LA},{SF, Chicago}, {NY C, London}}. Then, the answer is 2 as you need that many stops to go from SF to London. Give an algorithm which runs in time O(|V | ยท(|V | + |E|)) to solve this problem. You should state the algorithm clearly, prove its correctness and prove its time complexity.

Instruction Files

Related Questions in computer science category


Disclaimer
The ready solutions purchased from Library are already used solutions. Please do not submit them directly as it may lead to plagiarism. Once paid, the solution file download link will be sent to your provided email. Please either use them for learning purpose or re-write them in your own language. In case if you haven't get the email, do let us know via chat support.