centrality
Identifies structurally critical functions, types, and modules in a Swift codebase using weighted PageRank over the call graph, helping prioritize code review, refactoring, and test coverage.
Instructions
Compute Structural Importance Ranking (SIR) for the indexed codebase.
Runs a deterministic weighted PageRank over the sym-stub-resolved call graph. Edge weights are tuned per relation type (CALLS > INHERITS/CONFORMS/EXTENDS > IMPORTS > CONTAINS) and amplified for cross-module links; private symbols receive a post-convergence penalty. Scores are normalized to sum to 1.0.
Use this to:
Identify the most structurally critical functions, types, and protocols
Understand which modules are most depended upon
Prioritize code review, refactoring, or test coverage efforts
:param top: Maximum number of ranked entries to return (default 20).
:param kinds: Comma-separated node kinds to include: module, class,
struct, protocol, actor, function, method.
Empty string returns
all kinds. Ignored when group_by='module' (all kinds
contribute to module aggregation).
:param group_by: node (default) returns individual node rankings with
score, inbound edge count, and cross-module inbound count;
module aggregates node scores per module.
:return: Markdown-formatted ranking table.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| top | No | ||
| kinds | No | ||
| group_by | No | node |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |