feat: add depth parameter - #200
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #200 +/- ##
===================================
Coverage 85% 86%
===================================
Files 56 56
Lines 3459 3461 +2
===================================
+ Hits 2974 2980 +6
+ Misses 407 403 -4
Partials 78 78
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
RonsenbergVI
added a commit
that referenced
this pull request
Aug 22, 2026
🤖 I have created a release *beep* *boop* --- ## [0.1.0-beta.2](python/v0.1.0-beta.1...python/v0.1.0-beta.2) (2026-08-22) ### Features * add depth parameter ([#200](#200)) ([3dab727](3dab727)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
Type of change
Description of the changes
Adds depth parameter to graph search:
depth:1vsdepth:2, preciselyA recall's text/vector channels match a seed set$S$ , each seed $s$ carrying its fused seed mass $m(s)$ (raw BM25 + vector units). The traversal reaches the anchors (topic and entity vertices) adjacent to each seed. For an anchor $a$ with degree $d(a)$ , write
for the mass$a$ observes: the summed seed mass of every seed adjacent to it. With $T$ the set of every anchor any seed touched, both lanes fit the same null model. One background rate, the mass-per-edge a uniform smear over the touched neighbourhood would predict:
so$d(a),b$ is $a$ 's fair share: what an anchor of its size observes by chance. Admission happens after $b$ is fixed, so $b$ is identical in both lanes.
An anchor transmits to its members iff its observed mass clears the lane's admission bar:
($\theta$ is $f$ then scores
depthOneAdmission). A candidate factThe hinge inside the sum is the same in both lanes: plain fair share subtracted, the candidate' own mass excluded so a fact never funds its own boost. The only thing$\theta$ changes is which anchors appear in the sum.
Let$\rho(a) = M(a)/(d(a),b)$ be an anchor's excess ratio, how many times its null expectation it observed. Then:
depth:2admit any surplus at all:depth:1admits only anchors at more than twice chance:equivalently, anchors whose unexplained mass
explained mass
Three consequences fall out:
depth:0is that floor exactly. The traversal is skipped andBoth lanees are the same single anchor-mediated round,
depth:selects an admission bar, it does not iterate. A second round would re-observe the first round's concentrated mass through sibling anchors and collapse recall, which is whydepth:3+is rejected at parse time rather than silently answered as 2.Motivation for the changes
Allowing user to control what retrieval metric they want to optimise for
Breaking change?
If yes, fill this in
What breaks:
Before → after:
Migration:
How it was tested
Checklist
Notes for reviewers