diff options
| author | Sadeep Madurange <sadeep@asciimx.com> | 2025-11-02 14:31:47 +0800 |
|---|---|---|
| committer | Sadeep Madurange <sadeep@asciimx.com> | 2025-11-02 14:31:47 +0800 |
| commit | eb6497e805627137e15bf30d3ec46fb510103f56 (patch) | |
| tree | 4cb4850480722113b1e79a92283bb0a64c79699e /_site | |
| parent | 5c9f61600f3a81de6d1750b07dd609e19af4212f (diff) | |
| download | www-eb6497e805627137e15bf30d3ec46fb510103f56.tar.gz | |
neo4J post.
Diffstat (limited to '_site')
| -rw-r--r-- | _site/archive/neo4j-a-star-search/index.html | 46 | ||||
| -rw-r--r-- | _site/feed.xml | 2 | ||||
| -rw-r--r-- | _site/posts.xml | 2 |
3 files changed, 26 insertions, 24 deletions
diff --git a/_site/archive/neo4j-a-star-search/index.html b/_site/archive/neo4j-a-star-search/index.html index f37d00b..92d350d 100644 --- a/_site/archive/neo4j-a-star-search/index.html +++ b/_site/archive/neo4j-a-star-search/index.html @@ -46,10 +46,26 @@ <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 then-available shortest-path algorithms limited -our search to about 4,000 route points.</p> +Performance issues with Neo4J’s shortest-path algorithms limited our search to +about 4,000 route points.</p> -<p>The fix led to my first contribution to an open-source project:</p> +<p>A graph is a finite set of vertices, and a subset of vertex pairs known as +edges. Edges can have weights.</p> + +<p>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="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>package org.neo4j.graphalgo.impl; @@ -327,26 +343,12 @@ public class ShortestPathAStar extends Algorithm<ShortestPathAStar> { } } </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.</p> -<p>If you are new to them, a graph is a finite set of vertices (such as ports -ships are known to travel through), and a subset of vertex pairs (such as -origin and destination ports) known as edges.</p> - -<p>Edges can have weights. In the case of ships and ports, the weights could be -the distances between ports. For various 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>There’s nothing spectacular about the code. It is, for the most part, a patch -over Dijkstra’s algorithm that employs spherical distance between vertices as a -heuristic to steer the search in the right direction. Dijkstra’s algorithm, on -the other hand, explores all possible paths from the source, which is what -makes it slower.</p> - -<p>The heuristic function is domain-specific. I planned to make it configurable, -but didn’t get around to it. With the help of my A* algorithm, we scaled our -search to include all the route points of interest. <a href="https://github.com/neo4j-contrib/neo4j-graph-algorithms/releases/tag/3.4.0.0" class="external" target="_blank" rel="noopener noreferrer">Here’s</a> a link to -the now-archived official release.</p> +<p>The Neo4J graph algorithms open-source project <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</a> shipped +with my implementation of the A* search algorithm.</p> </div> <p class="post-author right">by Wickramage Don Sadeep Madurange</p> diff --git a/_site/feed.xml b/_site/feed.xml index 3548f7c..9abcade 100644 --- a/_site/feed.xml +++ b/_site/feed.xml @@ -1 +1 @@ -<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="4.4.1">Jekyll</generator><link href="/feed.xml" rel="self" type="application/atom+xml" /><link href="/" rel="alternate" type="text/html" /><updated>2025-11-02T11:45:12+08:00</updated><id>/feed.xml</id><title type="html">ASCIIMX | Archive</title><author><name>Wickramage Don Sadeep Madurange</name></author><entry><title type="html">Neo4J A* search</title><link href="/archive/neo4j-a-star-search/" rel="alternate" type="text/html" title="Neo4J A* search" /><published>2025-09-14T00:00:00+08:00</published><updated>2025-09-14T00:00:00+08:00</updated><id>/archive/neo4j-a-star-search</id><author><name>Wickramage Don Sadeep Madurange</name></author><summary type="html"><![CDATA[Back in 2018, we used the Neo4J 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 then-available shortest-path algorithms limited our search to about 4,000 route points.]]></summary></entry><entry><title type="html">My first PCB</title><link href="/archive/my-first-pcb/" rel="alternate" type="text/html" title="My first PCB" /><published>2025-07-14T00:00:00+08:00</published><updated>2025-07-14T00:00:00+08:00</updated><id>/archive/my-first-pcb</id><author><name>Wickramage Don Sadeep Madurange</name></author><summary type="html"><![CDATA[In 2023, I started tinkering with DIY electronics as a hobby. Until now, I’ve been using development boards like the Arduino Uno and ESP-32-WROOM so that I can focus on the software. Recently, I decided to step outside of my comfort zone and design a PCB from scratch for a door lock I’m working on.]]></summary></entry><entry><title type="html">MOSFETs</title><link href="/archive/mosfet-switches/" rel="alternate" type="text/html" title="MOSFETs" /><published>2025-06-22T00:00:00+08:00</published><updated>2025-06-22T00:00:00+08:00</updated><id>/archive/mosfet-switches</id><author><name>Wickramage Don Sadeep Madurange</name></author><summary type="html"><![CDATA[Recently, I needed a low-power circuit for one of my battery-operated projects. Much of the system’s power savings depended on its ability to switch off power to components, such as servos, electronically when not needed. That’s how I stumbled upon MOSFETs, transistors capable of controlling circuits operating at voltages far above their own.]]></summary></entry><entry><title type="html">Awesome books</title><link href="/archive/awesome-books/" rel="alternate" type="text/html" title="Awesome books" /><published>2025-04-20T00:00:00+08:00</published><updated>2025-04-20T00:00:00+08:00</updated><id>/archive/awesome-books</id><author><name>Wickramage Don Sadeep Madurange</name></author><summary type="html"><![CDATA[This article contains a list of my favourite books.]]></summary></entry><entry><title type="html">Programming ATmega328P chips</title><link href="/archive/arduino-uno/" rel="alternate" type="text/html" title="Programming ATmega328P chips" /><published>2025-04-10T00:00:00+08:00</published><updated>2025-04-10T00:00:00+08:00</updated><id>/archive/arduino-uno</id><author><name>Wickramage Don Sadeep Madurange</name></author><summary type="html"><![CDATA[This post is a step-by-step guide for wiring up ATmega328P ICs to run at 5V with a 16MHz crystal and 3.3V with an 8MHz crystal. While the 5V configuration is common, the 3.3V configuration can be advantageous in low-power applications and when interfacing with parts that run at 3.3V.]]></summary></entry><entry><title type="html">Bare-metal ARM Cortex M3 chips</title><link href="/archive/arduino-due/" rel="alternate" type="text/html" title="Bare-metal ARM Cortex M3 chips" /><published>2024-10-05T00:00:00+08:00</published><updated>2024-10-05T00:00:00+08:00</updated><id>/archive/arduino-due</id><author><name>Wickramage Don Sadeep Madurange</name></author><summary type="html"><![CDATA[This post is about programming bare metal SAM3X8E Arm Cortex M3 chips found on Arduino Due boards. I had to learn how to do this because none of the high-level tools for programming Arduino Dues are available for OpenBSD, which I use for much of my personal computing.]]></summary></entry></feed>
\ No newline at end of file +<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="4.4.1">Jekyll</generator><link href="/feed.xml" rel="self" type="application/atom+xml" /><link href="/" rel="alternate" type="text/html" /><updated>2025-11-02T14:31:35+08:00</updated><id>/feed.xml</id><title type="html">ASCIIMX | Archive</title><author><name>Wickramage Don Sadeep Madurange</name></author><entry><title type="html">Neo4J A* search</title><link href="/archive/neo4j-a-star-search/" rel="alternate" type="text/html" title="Neo4J A* search" /><published>2025-09-14T00:00:00+08:00</published><updated>2025-09-14T00:00:00+08:00</updated><id>/archive/neo4j-a-star-search</id><author><name>Wickramage Don Sadeep Madurange</name></author><summary type="html"><![CDATA[Back in 2018, we used the Neo4J 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.]]></summary></entry><entry><title type="html">My first PCB</title><link href="/archive/my-first-pcb/" rel="alternate" type="text/html" title="My first PCB" /><published>2025-07-14T00:00:00+08:00</published><updated>2025-07-14T00:00:00+08:00</updated><id>/archive/my-first-pcb</id><author><name>Wickramage Don Sadeep Madurange</name></author><summary type="html"><![CDATA[In 2023, I started tinkering with DIY electronics as a hobby. Until now, I’ve been using development boards like the Arduino Uno and ESP-32-WROOM so that I can focus on the software. Recently, I decided to step outside of my comfort zone and design a PCB from scratch for a door lock I’m working on.]]></summary></entry><entry><title type="html">MOSFETs</title><link href="/archive/mosfet-switches/" rel="alternate" type="text/html" title="MOSFETs" /><published>2025-06-22T00:00:00+08:00</published><updated>2025-06-22T00:00:00+08:00</updated><id>/archive/mosfet-switches</id><author><name>Wickramage Don Sadeep Madurange</name></author><summary type="html"><![CDATA[Recently, I needed a low-power circuit for one of my battery-operated projects. Much of the system’s power savings depended on its ability to switch off power to components, such as servos, electronically when not needed. That’s how I stumbled upon MOSFETs, transistors capable of controlling circuits operating at voltages far above their own.]]></summary></entry><entry><title type="html">Awesome books</title><link href="/archive/awesome-books/" rel="alternate" type="text/html" title="Awesome books" /><published>2025-04-20T00:00:00+08:00</published><updated>2025-04-20T00:00:00+08:00</updated><id>/archive/awesome-books</id><author><name>Wickramage Don Sadeep Madurange</name></author><summary type="html"><![CDATA[This article contains a list of my favourite books.]]></summary></entry><entry><title type="html">Programming ATmega328P chips</title><link href="/archive/arduino-uno/" rel="alternate" type="text/html" title="Programming ATmega328P chips" /><published>2025-04-10T00:00:00+08:00</published><updated>2025-04-10T00:00:00+08:00</updated><id>/archive/arduino-uno</id><author><name>Wickramage Don Sadeep Madurange</name></author><summary type="html"><![CDATA[This post is a step-by-step guide for wiring up ATmega328P ICs to run at 5V with a 16MHz crystal and 3.3V with an 8MHz crystal. While the 5V configuration is common, the 3.3V configuration can be advantageous in low-power applications and when interfacing with parts that run at 3.3V.]]></summary></entry><entry><title type="html">Bare-metal ARM Cortex M3 chips</title><link href="/archive/arduino-due/" rel="alternate" type="text/html" title="Bare-metal ARM Cortex M3 chips" /><published>2024-10-05T00:00:00+08:00</published><updated>2024-10-05T00:00:00+08:00</updated><id>/archive/arduino-due</id><author><name>Wickramage Don Sadeep Madurange</name></author><summary type="html"><![CDATA[This post is about programming bare metal SAM3X8E Arm Cortex M3 chips found on Arduino Due boards. I had to learn how to do this because none of the high-level tools for programming Arduino Dues are available for OpenBSD, which I use for much of my personal computing.]]></summary></entry></feed>
\ No newline at end of file diff --git a/_site/posts.xml b/_site/posts.xml index 1ecb22e..cef4242 100644 --- a/_site/posts.xml +++ b/_site/posts.xml @@ -1 +1 @@ -<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="4.4.1">Jekyll</generator><link href="/posts.xml" rel="self" type="application/atom+xml" /><link href="/" rel="alternate" type="text/html" /><updated>2025-11-02T11:45:12+08:00</updated><id>/posts.xml</id><title type="html">ASCIIMX</title><author><name>Wickramage Don Sadeep Madurange</name></author></feed>
\ No newline at end of file +<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="4.4.1">Jekyll</generator><link href="/posts.xml" rel="self" type="application/atom+xml" /><link href="/" rel="alternate" type="text/html" /><updated>2025-11-02T14:31:35+08:00</updated><id>/posts.xml</id><title type="html">ASCIIMX</title><author><name>Wickramage Don Sadeep Madurange</name></author></feed>
\ No newline at end of file |
