summaryrefslogtreecommitdiffstats
path: root/_site/archive/neo4j-a-star-search/index.html
diff options
context:
space:
mode:
Diffstat (limited to '_site/archive/neo4j-a-star-search/index.html')
-rw-r--r--_site/archive/neo4j-a-star-search/index.html46
1 files changed, 25 insertions, 21 deletions
diff --git a/_site/archive/neo4j-a-star-search/index.html b/_site/archive/neo4j-a-star-search/index.html
index 826ea2c..700630d 100644
--- a/_site/archive/neo4j-a-star-search/index.html
+++ b/_site/archive/neo4j-a-star-search/index.html
@@ -43,27 +43,30 @@
<h2 class="center" id="title">NEO4J A* SEARCH</h2>
<h6 class="center">14 SEPTEMBER 2025</h5>
<br>
- <div class="twocol justify"><p>Back in 2018, we used the <a href="https://neo4j.com/" class="external" target="_blank" rel="noopener noreferrer">Neo4J</a> graph database
-to track the movement of marine vessels. We were interested in the shortest
-path a ship could take through a network of about 13,000 route points.
-Performance issues with Neo4J’s shortest-path algorithms limited our search to
-about 4,000 route points.</p>
-
-<p>A graph is a finite set of vertices, and a subset of vertex pairs known as
-edges. Edges can have weights. In the case of vessel tracking, the route points
-can be modeled as a graph with the distances between them as weights. For
-different reasons, people are interested in minimizing (or maximizing) the
-weight of a path through a set of vertices. For instance, we may want to find
-the shortest path between two ports.</p>
-
-<p>Dijkstra’s algorithm is one such algorithm that finds the shortest path between
-two vertices. The one drawback of this algorithm is that it computes all the
-shortest paths from the source to all other vertices before terminating at the
-destination vertex.</p>
-
-<p>The following enhancement, also known as the A* search, employs spherical
-distance between route points (which are on the earth’s surface) as a heuristic
-to steer the search in the direction of the destination far more quickly:</p>
+ <div class="twocol justify"><p>Back in 2018, we used <a href="https://neo4j.com/" class="external" target="_blank" rel="noopener noreferrer">Neo4J</a> graph database to track the
+movement of marine vessels. We were interested in the shortest path a ship
+could take through a network of about 13,000 route points. Algorithms based on
+graph theory, such as A* search, provide an optimal solution to this
+problem. Therefore, it was useful to model the set of route points as a graph.</p>
+
+<p>A graph is a finite set of vertices, and a subset of vertex pairs (edges).
+Edges can have weights. In the case of vessel tracking, the route points form
+the vertices of a graph; the routes between them, the edges; and the distances
+between them are the weights. For different reasons, people are interested in
+minimizing (or maximizing) the weight of a path through a set of vertices. For
+instance, we may want to find the shortest path between two ports.</p>
+
+<p>Given such a graph, an algorithm like Dijkstra’s search could compute the
+shortest path between two vertices. In fact, this was the algorithm the Neo4J
+project shipped with at the time. One drawback of Dijkstra’s algorithm is that
+it computes all the shortest paths from the source to all other vertices before
+terminating at the destination vertex. The exhaustive nature of this search
+limited our search to about 4,000 route points.</p>
+
+<p>The following enhancement to Dijkstra’s search, also known as the A* search,
+employs a heuristic to steer the search in the direction of the destination
+more quickly. In the case of our network of vessels, which are on the earth’s
+surface, spherical distance is a good candidate for a heuristic:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>package org.neo4j.graphalgo.impl;
@@ -341,6 +344,7 @@ public class ShortestPathAStar extends Algorithm&lt;ShortestPathAStar&gt; {
}
}
</code></pre></div></div>
+
<p>The heuristic function is domain-specific. If chosen wisely, it can
significantly speed up the search. In our case, we achieved a 300x speedup,
enabling us to expand our search from 4,000 to 13,000 route points. The <a href="https://github.com/neo4j-contrib/neo4j-graph-algorithms/releases/tag/3.4.0.0" class="external" target="_blank" rel="noopener noreferrer">v3.4.0</a> of the