explain: ranking neighbours by degree makes output worse as the graph grows (measured: coverage 34/75 -> 19/75 after a rebuild)
Summary
graphify explain "<node>" ranks a node's neighbours by G.degree() and caps the list at 20. Degree is a popularity prior, not a relevance signal, so as a graph grows the top-20 fills with hub nodes and the output becomes less useful. I measured this directly on the same corpus before and after a rebuild.
The ranking
connections.sort(key=lambda c: G.degree(c[1]), reverse=True)
...[:20]
Verified empirically — neighbour degrees printed for one concept came out monotonically non-increasing:
[15, 13, 13, 8, 7, 7, 7, 6, 4, 3, 3, 2, 1, 1, 1, 1]
Measurement
Same vault, same 15 concept labels, same scoring rule. The only change between the two rows is a full extract + update that roughly doubled the graph.
| graph | nodes | distinct useful source files in explain's top-20 |
|---|---|---|
| before rebuild | 5,694 | 34 / 75 slots |
| after rebuild | 9,870 | 19 / 75 slots |
Coverage fell by 44% while the graph grew by 73%. More knowledge in, less usable neighbourhood out.
For context, plain BM25 over the same corpus filled 72/75 slots, and on blind relevance grading scored precision@5 0.627 vs 0.107 for explain on the rebuilt graph. (Grading was blinded, with hard negatives and planted positives as instrument checks; BM25 was graded four separate times across independent runs at 0.587 / 0.613 / 0.600 / 0.627, so grader variance is ~0.04 and does not explain the gap.)
Mechanism
Two things compound:
- Hubs crowd the cap. In a bigger graph, more neighbours are high-degree, so the top-20 skews toward nodes that connect to everything and therefore discriminate nothing.
- Docstring
rationalenodes. Our rebuilt graph has 2,211rationalenodes, many labelled with truncated docstring fragments ("How manyassertstatements the selftest contains, read off the AST. Derived…"). These carry real degree and consume top-20 slots without pointing at a distinct useful file.
Suggestions
- Penalise degree instead of rewarding it — an IDF-style
1/log(1+degree)factor is the graph analogue of what makes BM25 work, and would push generic hubs down rather than up. - Rank by edge quality, which the graph already stores and currently ignores here:
confidence(EXTRACTED/INFERRED/AMBIGUOUS),confidence_score, andrelationtype. Aconceptually_related_toedge is far more informative than acontainsedge, and this data is already on every link. - Diversify by source file before applying the cap, so 20 slots do not collapse onto a handful of files.
A related symptom in query: the truncation notice reads "The answer may be among the N cut nodes." If the cut were applied after a relevance ordering rather than in traversal order, that sentence would not need to exist.
Environment
- graphify 0.9.50 (pipx), Python 3.14, Windows 11
- Corpus: personal knowledge vault, ~2,200 markdown notes plus scripts
- Graph: 9,870 nodes / 17,436 edges / 2,183 concept nodes, built with
--backend claude-cli
Paso no vengan por q nodere yo kien valla ignoren todo sovre mi adios