The
Manhattan distance (also known as the
city block metric) is a metric that is used to define the seperation of two instances of something.
In geometric terms, in a 2D Euclidean space, the distance between points a and b is defined as
d(a,b) = |(xb - xa)| + |(yb - ya)|
In other words, how far across and how far up? It is called the Manhattan distance because the street layout of cities like Manhattan are grids so to travel between any two points, you must walk along the roads.