Graph Theory37 sections · 1633 units
Open in Course

Core Idea - Manhattan Distance

(Computing edge weights)

Manhattan distance is x1x2+y1y2|x_1 - x_2| + |y_1 - y_2|. It measures distance in a grid where you can only move horizontally or vertically. This is different from Euclidean distance (straight-line distance). Manhattan distance is easier to compute: no square roots needed.

For MST purposes, Manhattan distance works like any other edge weight. Compute it and treat it as a cost. The algorithm does not care about the formula.