PathFinder: A unified approach for handling paths in graph query languages
This paper introduces PathFinder, a unified and highly efficient approach for processing path queries in modern graph languages that leverages compact path representation and pipelined execution to achieve stable performance and outperform existing graph engines by an order of magnitude.
Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
Imagine you are exploring a massive, magical city called Graph City. In this city, every person is a building (a node), and every relationship between them is a road (an edge) with a specific sign on it, like "follows," "lives," or "works."
For years, the city's tour guides (the old database engines) had a weird rule: if you asked, "Show me all the ways I can get from Joe to the Eiffel Tower by only taking 'follows' roads," the guide would just point and say, "Okay, you can get there!" and stop. They would give you the destination, but they wouldn't show you the map of the journey.
This is a problem for detectives. If you are trying to solve a mystery (like spotting money laundering or tracking a rumor), you don't just want to know who is connected; you need to see the entire path they took. Did they go straight there? Did they loop around three times? Did they take a shortcut?
Enter PathFinder, a new, super-smart tour guide built by Benjamín, Wim, Carlos, and Domagoj. This paper introduces PathFinder, the first guide that can not only tell you who is connected but also hand you the exact map of every possible route, no matter how complicated the rules are.
The Magic of the "Product Graph"
How does PathFinder do this without getting lost in a maze? Imagine you have a regular map of the city, and you also have a tiny, magical checklist (an automaton) that says, "You must take a 'follows' road, then another 'follows' road, then a 'works' road."
PathFinder doesn't just walk the city; it builds a shadow city (called a Product Graph) where every building is a combination of a real city building and a step on the checklist.
- If you are at "Joe" and have taken zero steps, you are at
(Joe, Step 0). - If you take a "follows" road to "Paul," you move to
(Paul, Step 1).
By walking through this shadow city, PathFinder can instantly see which routes match your checklist. It's like having a GPS that only lights up the roads you are allowed to drive on, ignoring the rest.
The 27 Ways to Walk
The paper explains that there are 27 different rules (called "modes") for how you can walk through Graph City. PathFinder is the first engine that can handle all 27 of them. Here are a few of the flavors:
- WALK: You can go anywhere, even if you walk in circles or visit the same house twice. (This is the easiest, but can lead to infinite loops!).
- TRAIL: You can visit the same house twice, but you can't walk on the same road twice.
- SIMPLE: You can't visit the same house twice (unless you start and end at the same spot). This is the hardest rule to follow because the number of possible paths can explode.
- ANY SHORTEST: Just give me one of the fastest routes.
- ALL SHORTEST: Give me every single route that is the fastest.
- SHORTEST k GROUPS: Give me the fastest routes, then the second-fastest group of routes, and so on, up to groups.
The authors show that while some of these rules (like finding a "Simple" path) are theoretically very hard—so hard that computers usually give up on huge maps—PathFinder handles them surprisingly well in the real world.
The "Infinite Loop" Problem
One big headache in Graph City is that if there is a loop (like Joe follows Paul, and Paul follows Joe), you could walk around that loop forever. If you ask for "all walks," the answer is infinite!
To fix this, the GQL and SQL/PGQ standards (the rulebooks for these languages) let you pick a mode like "Simple" or "Trail" to stop the infinite loops. PathFinder respects these rules perfectly. It knows exactly when to stop exploring a path so it doesn't get stuck in an endless circle, while still finding all the valid paths you asked for.
The Speed Test: PathFinder vs. The Rest
The authors didn't just build PathFinder; they put it to the test against the big names in the industry: Neo4j, Nebula, Kuzu, Jena, Blazegraph, and Virtuoso.
They ran tests on three different scenarios:
- Pokec: A medium-sized social network with 1.6 million people and 30 million connections.
- Wikidata: A gigantic real-world knowledge graph with 364 million nodes and 1.257 billion edges.
- Diamond: A tricky, mathematically constructed graph designed to have an exponential number of paths (specifically, paths).
The Results:
- Speed: PathFinder was 10 to 100 times faster than the other engines in almost every test.
- Stability: While other engines started to crash or time out (give up) when paths got longer or more complex, PathFinder kept chugging along.
- The "Intractable" Surprise: For the "Simple" and "Trail" modes, theory says the computer should take forever to find the answer. But in the real-world tests (like on Wikidata), PathFinder found 100,000 paths quickly. The authors suggest this is because real-world data doesn't usually have the specific "perfect storm" of connections that makes the math explode.
What PathFinder Does NOT Do (Yet)
It's important to know what this paper doesn't claim:
- It doesn't say PathFinder is magic. If you ask for every single path in a graph with loops, the answer is still infinite, and no computer can print that. PathFinder just stops at a limit you set (like 100,000 results).
- It doesn't claim to have solved the "Simple Path" problem for all possible graphs. The paper admits that in the worst-case theoretical scenarios, finding a simple path is still NP-complete (a fancy way of saying "computationally very hard"). PathFinder just works better than everyone else on the graphs we actually use in real life.
- It doesn't claim to have fixed the "Simple" mode for RDF (a specific type of data format) yet. The authors say they haven't implemented the "Trail" mode for RDF because it's unclear how to define a "trail" when edges don't have unique names.
The Bottom Line
PathFinder is a new engine that acts like a super-powered tour guide. It can take a complex set of rules (like "Find all paths from Joe to ENS Paris that follow the pattern 'follows' then 'works'") and return the actual maps of those journeys.
The authors measured this on real data and found that PathFinder is significantly faster and more stable than current top-tier graph databases. They even showed that it can be added to existing systems (like SPARQL engines) to give them this new superpower. While the math says some of these tasks should be impossible to do quickly, in the messy, real world, PathFinder proves that it can be done with remarkable speed.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.