You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Hop labels use min-hop semantics even when min_hops filters shorter paths #878
When using min_hops to filter paths, hop labels still use "first seen" (minimum hop) semantics. This causes nodes reachable via multiple path lengths to be labeled with the shortest path's hop distance, even when that shorter path is filtered out by min_hops.
Reproduction
nodes= [{"id": x} forxin ["a", "b", "c", "d", "x"]]
edges= [
{"edge_id": "e1", "src": "a", "dst": "b"},
{"edge_id": "e2", "src": "b", "dst": "c"},
{"edge_id": "e3", "src": "c", "dst": "d"},
{"edge_id": "short1", "src": "a", "dst": "x"},
{"edge_id": "short2", "src": "x", "dst": "d"},
]
# Graph has two paths from a to d:# - Long path: a→b→c→d (3 hops)# - Short path: a→x→d (2 hops)ops= [
n({"id": "a"}),
e_forward(min_hops=3, max_hops=3, label_node_hops="hop"),
n(),
]
# With min_hops=3, only the long path is valid# Expected: node d labeled with hop=3# Actual: node d labeled with hop=2 (from filtered-out short path)
Root Cause
The hop labeling logic in hop.py tracks minimum hop distance per node (groupby().min() pattern). This is correct for display purposes when all paths are valid, but incorrect when min_hops filters out shorter paths.
The Yannakakis semijoin pruning correctly excludes edges not on valid paths, but the hop labels are computed before/independently of this filtering.
Impact
Hop labels may show incorrect distances when min_hops > 1
This is a display/labeling issue only - path validity and edge filtering are correct
Fixed by #1581, merged at 2026-05-20T21:34:45Z as 842c403.
Closeout:
hop(..., min_hops=..., label_node_hops=...) now labels directed nodes from the shortest retained path after min_hops pruning, instead of stale first-seen labels from filtered shorter branches.
Added pandas/reverse/cuDF regression coverage plus retained-path reference parity updates.
Validation: focused local pytest 154 passed, 10 skipped; ruff; typecheck; DGX RAPIDS 25.02/26.02 targeted cuDF smoke; full PR CI green including changed-line coverage.
Activity
lmeyerov commentedon May 20, 2026
Fixed by #1581, merged at 2026-05-20T21:34:45Z as 842c403.
Closeout:
hop(..., min_hops=..., label_node_hops=...)now labels directed nodes from the shortest retained path aftermin_hopspruning, instead of stale first-seen labels from filtered shorter branches.154 passed, 10 skipped; ruff; typecheck; DGX RAPIDS 25.02/26.02 targeted cuDF smoke; full PR CI green including changed-line coverage.