Skip to content

perf(graph): search shortest paths from both ends - #37

Merged
prrao87 merged 4 commits into
codex/issue-11-bounded-csrfrom
codex/issue-17-bidirectional-shortest-path
Oct 26, 2026
Merged

prrao87 merged 4 commits into
codex/issue-11-bounded-csrfrom
codex/issue-17-bidirectional-shortest-path

Conversation

@stugorf

@stugorf stugorf commented Oct 26, 2026

Copy link
Copy Markdown
Member

Problem and change

Resolves #17. Bound endpoint pairs expand complete smaller-frontier layers bidirectionally when reverse adjacency is available. Both predecessor graphs retain every shortest alternative and parallel-edge multiplicity, joining at a correct depth cut. Shared one-to-many source searches keep their forward search. Directed fallback and relationship-alternation semantics remain unchanged.

Native tests compare independently expected results across every directed three-node graph, endpoint pairs and hop bounds. Separate cases cover odd/even distances, several meeting nodes, duplicates, cycles, self-loops, equal endpoints, no path and a wide middle layer. Python tests cover incoming/outgoing/undirected, optional and shared-source queries with and without CSR. Guides document the execution strategy and tie behavior; Python signatures do not change.

Validation

Head 09a92e424bd8a7dffc0c3ff6a82838dc088de59e; frozen parent e127755c872949733c69435047384c9d17fb572b. Focused checks and regression details record commands, results, documentation and compatibility. The release receipt pins wheel/archive identity and 118 installed tests.

Both complete workloads pass unchanged goldens in memory and lazy modes. Retained first-pass geometric mean speedups are below (greater than one is faster). Per-query results and paired investigations remain in the audit archive.

Workload/mode Main Actual parent
Q30 memory 0.950 0.971
Q30 lazy 0.926 0.992
IC memory 1.053 1.071
IC lazy 1.121 1.108

Measurements use the same Apple M4 Max (16 cores, 128 GiB), macOS 26.6.2 arm64 and Python 3.13.17, with Q30 revision 6260689 and IC revision c185123. Reproduction instructions pin settings, data checksums, locks and commands. The frozen main baseline is code-identical to current main 90114f3; the equivalence check also verifies clean prospective main-target merges.

This is a coordinated draft. Preserve its frozen-head outcomes and apply the shared corrections in the qualified integration; changing the actual target requires requalification. The accepted combined engine source is 7d2ef3e; its current-main documentation merge is 5fe24cd.

User impact

Bound endpoint pairs use complete smaller-frontier layers; shared one-to-many search and shortest-path multiplicity remain supported. Python signatures and relationship-alternation scope are unchanged; strategy docs are updated.

Review ledger · Current contribution guide

Audit archive: 47,675,190 bytes; SHA-256 b3486fb30a34639c830b5d49353b3838f96369f95df959ac35f85511f7f8b2de. The small current-main supplement preserves the documentation update. Original absolute paths in receipts map to included records through the archive index.

Submitted by David Hughes (@stugorf), with AI Collaboration.

stugorf and others added 4 commits October 25, 2026 10:08
Resolve #17 with complete-layer bidirectional search for single-target CSR queries, preserving all shortest paths and duplicate edges. Keep shared forward search for multiple targets.

Developed by David Hughes with assistance from Codex.
#53)

* chore: rename rust crates to lance-csr for crates.io

Upstream owns the lance-graph and lance-graph-catalog names on crates.io,
so publishing needs our own. Renames the crates, directories and Rust
paths to lance-csr*, points the manifests at this repository, and ships
LICENSE and NOTICE with the published crates.

* feat: expose CypherEngine as a Rust API and bump to 0.3.0

Move the cached engine (snapshot, CSR adjacencies, node indexes,
join-key statistics and refresh) from the PyO3 bindings into the
lance-csr crate as an async CypherEngine. The Python class is now a
thin wrapper with the same API and exception types.

refresh() now holds an async lock for the whole operation, so
overlapping refreshes can no longer publish an older snapshot after a
newer one (fixes #12).

Add engine tests, a deterministic refresh race test, a runnable
embedded_query example that CI runs, and a "Using from Rust" docs
page whose snippets are included from that example. Bump the crates
and the Python package to 0.3.0.
@prrao87
prrao87 marked this pull request as ready for review October 26, 2026 16:14
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying lance-csr with  Cloudflare Pages  Cloudflare Pages

Latest commit: c73f565
Status: ✅  Deploy successful!
Preview URL: https://8e95c925.lance-csr.pages.dev
Branch Preview URL: https://codex-issue-17-bidirectional.lance-csr.pages.dev

View logs

@prrao87
prrao87 merged commit cafb3be into codex/issue-11-bounded-csr Oct 26, 2026
8 checks passed
@prrao87
prrao87 deleted the codex/issue-17-bidirectional-shortest-path branch October 26, 2026 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants