see

Path Discovery

What this example is about

This example searches an airport graph for routes from Ostend-Bruges International Airport to Václav Havel Airport Prague with at most two stopovers.

The source data is large, but the query is bounded so the explanation can show the relevant slice of the search.

How it works, in plain language

The graph contains airports and outbound route facts. The program starts at the source airport and recursively follows outbound routes. It avoids revisiting airports already in the current path, and it stops expanding when the route would exceed the maximum number of stopovers.

A route is accepted only if it reaches the destination within the stopover limit.

What to notice in the output

The output finds three routes, all with two stopovers. Each route starts at Ostend-Bruges, goes through Liège, then through one of three second-hop airports before reaching Prague.

The diagnostic counts show how a large graph can still produce an inspectable bounded result: number of labels, outbound facts, frontier airports expanded, recursive calls, and edge tests.

What the trust gate checks

The trust gate verifies source and destination labels, route-count consistency, route starts and ends, stopover bounds, graph-fact hops, route simplicity, that the translated source graph is loaded, and that the search respects the configured depth bound.

Run it

From the repository root:

node examples/path_discovery.js

Files