Overview:
-
The Chebyshev distance between two points in real space is given by the maximum of the axis differences.
-
Chebyshev distance between two points of n-dimensions is given by
Chebyshev distance(P1, P2) = max(|xi-yi|) where i varies from 1 to n.
-
The SciPy function chebyshev() from the scipy.spatial.distance returns the Chebyshev distance between two points P1 and P2 in n-dimensions.
-
The Chebyshev distance is also called as the Chessboard distance.
-
Since Chebyshev distance deals with points from real space, when counting movements in a grid structure like chess board the discrete intervals need to be taken. Each cell is considered as 1 unit when movements are counted. In this context, Chebyshev distance is also called as chessboard distance. The Chebyshev distance gives the minimum number of moves required to go from one cell to another cell in the grid.
Example:
# Example Python program that finds the Chebyshev distance # Chebyshev distance between points on a 2-d plane chebyshev_distance = dist.chebyshev(point1, point2) # Chebyshev distance between points on a 3-d space chebyshev_distance = dist.chebyshev(point1, point2) |
Output:
Chebyshev distance:2 Chebyshev distance:3 |