Confidence Scoring & Node Ranking
Relevant source files
The following files were used as context for generating this wiki page:
Confidence Scoring and Node Ranking form the analytical core of Arbor, enabling the system to evaluate the reliability of its impact analysis and the architectural significance of specific code entities. By transforming a raw dependency graph into an assessed model, Arbor provides developers with actionable insights into the "blast radius" of changes and identifies central components within a codebase.
These systems work by analyzing graph topology—specifically incoming (caller) and outgoing (dependency) edges—to assign risk levels and architectural roles. This allows Arbor to distinguish between high-confidence static resolutions and lower-confidence heuristic guesses, while ranking nodes based on their global connectivity using iterative centrality algorithms.
Sources: crates/arbor-graph/src/confidence.rs, crates/arbor-graph/src/ranking.rs, README.md:129-145
Confidence Scoring System
The confidence system evaluates the reliability of impact analysis results. It categorizes results into three discrete levels based on the connectivity of a node and the size of its detected blast radius.
Confidence Levels
| Level | Description | Criteria |
|---|---|---|
| High | Fully resolved, statically verifiable paths. | Well-connected nodes with manageable impact (e.g., utility functions or leaf nodes with clear callers). |
| Medium | Partial uncertainty exists. | Entry points with many dependencies or nodes with a moderate blast radius (>20 nodes). |
| Low | Significant unknowns or heuristic resolution. | Isolated nodes or nodes with a very large blast radius (>50 nodes) affecting a significant portion of the codebase. |
Sources: crates/arbor-graph/src/confidence.rs:10-23, crates/arbor-graph/src/confidence.rs:43-85, README.md:131-137
Confidence Explanation Logic
The ConfidenceExplanation structure encapsulates the level, specific reasons for the score, and suggestions for the developer.
The diagram shows the logical flow for determining confidence based on node connectivity and blast radius size.
Sources: crates/arbor-graph/src/confidence.rs:43-85
Architectural Node Ranking
Node ranking identifies the most "significant" nodes in a codebase using a simplified PageRank variant. This centrality score represents the architectural importance of a component based on how many other components depend on it.
Centrality Computation
The compute_centrality function distributes scores along edges through multiple iterations. Nodes called by many other highly-ranked nodes receive higher scores.
- Initialization: All nodes start with an equal score ($1.0 / N$).
- Iterative Distribution: In each iteration, a node's score is updated based on a damping factor and the scores of its callers divided by their outgoing degree.
- Damping: A standard damping factor (default 0.85) is applied to prevent score concentration and simulate random jumps.
- Normalization: Final scores are normalized to a $[0, 1]$ range.
Sources: crates/arbor-graph/src/ranking.rs:37-81
Node Role Classification
Arbor automatically infers the architectural role of a node based on its position in the graph.
| Role | Definition | Logic (Upstream/Downstream) |
|---|---|---|
| EntryPoint | APIs, CLIs, or main functions. | Has downstream dependencies but no internal callers. |
| Utility | Widely reused helper functions. | Has upstream callers but no outgoing dependencies. |
| Core Logic | Central domain/business rules. | Has both callers and dependencies. |
| Adapter | Boundary between layers. | High asymmetry (e.g., $\le 2$ callers but $> 5$ dependencies). |
| Isolated | Potential dead code or dynamic entry. | No detected connections in the graph. |
Sources: crates/arbor-graph/src/confidence.rs:114-153, README.md:139-145
Integration and Usage
Confidence scores and rankings are exposed through various Arbor interfaces, including the CLI, GUI, and MCP bridge.
Command Line Interface (CLI)
When running arbor refactor <symbol>, the CLI displays the confidence level and role to help developers assess risk.
- Refactor Command: Uses
ConfidenceExplanation::from_analysisto provide a "warm, opinionated output." - Why Flag: Provides detailed reasoning, such as "High caller count indicates well-integrated code."
Sources: crates/arbor-cli/src/commands.rs:480-508, crates/arbor-cli/src/commands.rs:511-532
Model Context Protocol (MCP)
For AI agents (e.g., Claude), the MCP analyze_impact tool returns structured JSON containing both the confidence level and the calculated role.
{
"target": { "name": "detect_language", "kind": "Function" },
"confidence": {
"level": "High",
"reasons": ["15 callers, 3 dependencies", "Well-connected with manageable impact"]
},
"role": "Core Logic",
"total_affected": 18
}
Sources: crates/arbor-mcp/src/lib.rs:218-245, README.md:52-68
Graphical User Interface (GUI)
The Arbor GUI displays the node's role and confidence level in the analysis panel. It also uses centrality scores for initial graph layouts to ensure significant nodes are prominent.
This diagram illustrates how the UI components interact with the ranking and confidence modules to present data to the user.
Sources: crates/arbor-gui/src/app.rs:105-156, crates/arbor-cli/src/commands.rs:194-197
Summary
Confidence Scoring and Node Ranking provide the necessary context to interpret Arbor's raw dependency data. By classifying nodes into architectural roles and assigning a reliability score to impact analyses, Arbor enables developers to prioritize testing efforts and understand the structural significance of their changes. Centrality ranking further assists in both automated LLM context retrieval and visual navigation of large codebases.
Sources: crates/arbor-graph/src/lib.rs:43-55, README.md:129-145