Skip to content

Commit 9ab5d45

Browse files
committed
feat(diffctx): hub suppression categories, edge weights, lambda tuning
1 parent a67dcc7 commit 9ab5d45

5 files changed

Lines changed: 7 additions & 5 deletions

File tree

src/treemapper/diffctx/config/weights.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ class EdgeWeightConfig:
2121
"doc_structure": EdgeWeightConfig(0.30, 0.83),
2222
"anchor_link": EdgeWeightConfig(0.55, 0.64),
2323
"citation": EdgeWeightConfig(0.25, 1.0),
24-
"python_call": EdgeWeightConfig(0.55, 0.70),
25-
"python_symbol": EdgeWeightConfig(0.60, 0.70),
24+
"python_call": EdgeWeightConfig(0.65, 0.70),
25+
"python_symbol": EdgeWeightConfig(0.70, 0.70),
2626
"python_type": EdgeWeightConfig(0.50, 0.70),
2727
"javascript_call": EdgeWeightConfig(0.70, 0.50),
2828
"javascript_symbol": EdgeWeightConfig(0.75, 0.50),
@@ -80,7 +80,7 @@ class LangWeights:
8080

8181

8282
LANG_WEIGHTS: dict[str, LangWeights] = {
83-
"python": LangWeights(0.55, 0.60, 0.50, 0.20, 0.35),
83+
"python": LangWeights(0.65, 0.70, 0.50, 0.20, 0.35),
8484
"javascript": LangWeights(0.50, 0.55, 0.45, 0.25, 0.35),
8585
"jsx": LangWeights(0.50, 0.55, 0.45, 0.25, 0.35),
8686
"typescript": LangWeights(0.70, 0.75, 0.65, 0.15, 0.25),

src/treemapper/diffctx/edges/structural/sibling.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
class SiblingEdgeBuilder(EdgeBuilder):
1212
weight = EDGE_WEIGHTS["sibling"].forward
1313
reverse_weight_factor = EDGE_WEIGHTS["sibling"].reverse_factor
14+
category = "sibling"
1415

1516
def build(self, fragments: list[Fragment], repo_root: Path | None = None) -> EdgeDict:
1617
by_dir = self._group_files_by_dir(fragments)

src/treemapper/diffctx/edges/structural/test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ class TestEdgeBuilder(EdgeBuilder):
9292
weight_direct = EDGE_WEIGHTS["test_direct"].forward
9393
weight_naming = EDGE_WEIGHTS["test_naming"].forward
9494
reverse_weight_factor = EDGE_WEIGHTS["test_reverse"].forward / EDGE_WEIGHTS["test_direct"].forward
95+
category = "test_edge"
9596

9697
def discover_related_files(
9798
self,

src/treemapper/diffctx/graph.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def build_graph(fragments: list[Fragment], repo_root: Path | None = None) -> Gra
7979
return graph
8080

8181

82-
_SUPPRESSION_EXEMPT = frozenset({"semantic", "structural", "config", "document"})
82+
_SUPPRESSION_EXEMPT = frozenset({"semantic", "structural"})
8383

8484

8585
def _apply_hub_suppression(

src/treemapper/diffctx/ppr.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def personalized_pagerank(
106106
seeds: set[FragmentId],
107107
alpha: float = 0.60,
108108
tol: float = 1e-4,
109-
lam: float = 0.5,
109+
lam: float = 0.4,
110110
seed_weights: dict[FragmentId, float] | None = None,
111111
) -> dict[FragmentId, float]:
112112
if not graph.nodes:

0 commit comments

Comments
 (0)