liveBook · Manning

Euclidean distance

As explained in Optimization Algorithms: AI techniques for design, planning, and control problems

Euclidean distance is the straight-line distance between points calculated from the square root of the sum of squared coordinate differences.

Euclidean distance measures the straight-line separation between points by taking the square root of the sum of squared coordinate differences. It provides a geometric notion of closeness for numerical data and spatial locations. section 4.3.3 section 11.3

Use Euclidean distance to:

  • Estimate the remaining cost from a node to a destination in A* search. section 4.3.3
  • Represent closeness among points in numerical, image, audio, text, or spatial data. section 11.3
  • Create distance heatmaps between points in traveling-salesperson problem instances. section 11.7

Routing and TSP

In A* routing, straight-line distance supplies h(n), the estimated cost from node n to the goal, alongside the traveled cost g(n). In TSP experiments, pairwise Euclidean distances appear as a normalized heatmap and help describe relationships among points before a model constructs a tour. section 4.3.3 section 11.7

Algorithm 4.4 A* algorithm
Inputs: Source node, Destination node
Output: Route from source to destination
  
Initialize A* heuristic ← sum of straight-line distance to source and destination
Initialize PQ ← min heap according to A* heuristic
Initialize frontier ← a PQ initialized with source
Initialize explored ← empty
Initialize found ← False
  
While frontier is not empty and found is False do
    Set node ← frontier.pop()
    Add node to explored
    For child in node.expand() do
        If child is not in explored and child is not in frontier then
            If child is destination then
                Update route ← child.route()
                Update found ← True
            Add child to frontier
  
Return route

Trace how a straight-line estimate participates in A* node selection, frontier management, expansion, and route construction. section 4.3.3

How Optimization Algorithms: AI techniques for design, planning, and control problems covers it

How deep it goes
Defines the metric and demonstrates applications in A* and TSP, without developing a detailed mathematical derivation.
Examples
Uses road-network routing, point-based TSP instances, and Euclidean-distance heatmaps as concrete examples.
What you can do after
Apply it as a straight-line heuristic and inspect pairwise distances in TSP experiments.
How it connects
Connects Euclidean distance to A* search, heuristic functions, traveling-salesperson problems, and graph machine learning.

Also explained in

Compare how 8 books explain Euclidean distance →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Optimization Algorithms: AI techniques for design, planning, and control problems. The section links point to the parts of the book it draws on.