Skip to content

perf(gfql/shortest-path): cache native graph state across pairwise calls#1705

Open
lmeyerov wants to merge 1 commit into
masterfrom
perf/gfql-shortestpath-cache
Open

perf(gfql/shortest-path): cache native graph state across pairwise calls#1705
lmeyerov wants to merge 1 commit into
masterfrom
perf/gfql-shortestpath-cache

Conversation

@lmeyerov

@lmeyerov lmeyerov commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Opt-in graph-state caching for the igraph/cugraph shortestPath path: the native backend rebuilt graph state on every pairwise call, so multi-pair shortestPath queries paid repeated construction. Caches the constructed graph state across calls within a query.

Split out from the (misplaced) benchmark branch as a standalone same-path perf change — independent of the #1658 index stack. Touches graphistry/compute/gfql/same_path/native_shortest_path.py (+ test). Cherry-picks cleanly onto master.

🤖 Generated with Claude Code

Add opt-in graph-state caching to the igraph/cugraph shortest-path
backends so multi-pair native calls reuse the built graph instead of
rebuilding it per call. Validated on dgx-spark: cuDF selected-pair
direct-native drops 104.4ms -> 57.8ms (~1.8x) on the full
100k-person / 2.42M-FOLLOWS graph-benchmark data, parity-clean on
small and full datasets for both engines.

The cache is threaded via optional cache/cache_key params (default
None = identical prior behavior). Also fixes a min_hops==0 self-pair
edge case: src==tgt with min_hops==0 now correctly returns hops=0
even when the node has no outgoing edges, instead of null.

Note: this accelerates the native helper only. The integrated GFQL
shortestPath query path is still dominated by per-query lowering
overhead (~465ms/query on full data); making that fast needs
seed-pushed lowering (tracked as P1), not this cache.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
(cherry picked from commit a885ffe7c36269feae37ade0799c25cf614e5aa5)
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.

1 participant