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.

Step 1 of 157%

Tutorial

Weighted Graphs

A graph G=(V,E)G=(V,E) is a pair where VV is a set of vertices (or nodes) and EE is a set of edges, each connecting two vertices.

In a weighted graph, every edge ee carries a real number w(e)w(e) called its weight. We write w(u,v)w(u,v) for the weight of the edge between vertices uu and vv. If there is no edge between uu and vv, then w(u,v)w(u,v) is undefined.

In airline routing, vertices represent airports and edges represent nonstop flights. The weight w(u,v)w(u,v) typically encodes the distance in miles, the flight time, or the ticket cost.

For example, consider a network on {A,B,C,D}\{A,B,C,D\} with flights

  • ABA\text{--}B with weight 300300
  • ACA\text{--}C with weight 500500
  • BDB\text{--}D with weight 450450
  • CDC\text{--}D with weight 200200

Then w(A,B)=300w(A,B)=300 and w(C,D)=200w(C,D)=200.

The total weight of a multi-edge route is the sum of the weights of its edges. For instance, the trip ABDA\to B\to D has total weight

w(A,B)+w(B,D)=300+450=750.w(A,B)+w(B,D)=300+450=750.
navigate · Enter open · Esc close · ⌘K/Ctrl K toggle