Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CHW 5 . 1 . So many options: Flying from O'Hare to LAX with at most one layover Connections between airports can be modelled by

CHW5.1. So many options: Flying from O'Hare to LAX with at most one layover
Connections between airports can be modelled by a graph. The nodes represent airports, and the edges represent nonstop flight routes between the airports. Two nodes are connected by a edge if there is a nonstop flight between the two airports; for simplicity, we assume that if there is a nonstop flight from one airport to another, there is a returning nonstop flight so that the graph is undirected.
The matrix nonstop_flights represents a network of 100 U.S. airports as described above. We ask you to determine the number of distinct routes to fly from O'Hare Airport (ORD) to Los Angeles International Airport (LAX) with at most one layover (that is, either nonstop or with exactly one layover).
Compute a 100100-matrix A such that the entry in the i-th row and the j-th column of A is the number of walks from node j to node i of length at most 2. Store this matrix as atmost_1_layover.
Assuming that ORD is airport # 63(the 64th row/column of the adjacency matrix when one-indexing) and LAX is airport # 84(the 85th row/column of the adjacency matrix when one-indexing). Compute the number of distict routes to fly from ORD to LAX with at most one layover. Save this as num_options.
The setup code gives the following variables:
\table[[Name,Type,Description],[nonstop_flights,\table[[numpy],[array]],\table[[Network of nonstop flight connections, 100100
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Administrator Limited Edition

Authors: Martif Way

1st Edition

B0CGG89N8Z

More Books

Students also viewed these Databases questions

Question

11. Name the seven types of data instructions and explain each.

Answered: 1 week ago

Question

How do Excel Pivot Tables handle data from non OLAP databases?

Answered: 1 week ago