Weighted Graphs and Adjacency
Introduces weighted graphs as the foundational data structure for air routing: vertices, edges, weights, neighbors, degree, and the (weighted) adjacency matrix.
Tutorial
Weighted Graphs
A graph is a pair where is a set of vertices (or nodes) and is a set of edges, each connecting two vertices.
In a weighted graph, every edge carries a real number called its weight. We write for the weight of the edge between vertices and . If there is no edge between and , then is undefined.
In airline routing, vertices represent airports and edges represent nonstop flights. The weight typically encodes the distance in miles, the flight time, or the ticket cost.
For example, consider a network on with flights
- with weight
- with weight
- with weight
- with weight
Then and .
The total weight of a multi-edge route is the sum of the weights of its edges. For instance, the trip has total weight