Documentation
¶
Index ¶
- func ComputeBetweenness(nodes []graph.Node, edges []graph.Edge) map[graph.NodeID]float64
- func ComputePageRank(nodes []graph.Node, edges []graph.Edge, damping float64, iterations int) map[graph.NodeID]float64
- func DetectCyclesReport(nodes []graph.Node, edges []graph.Edge, limit int) ([]Cycle, Coverage)
- func ShortestPath(nodes []graph.Node, edges []graph.Edge, startID, targetID graph.NodeID) []graph.NodeID
- type Community
- type Coverage
- type Cycle
- type DependencyView
- type IndirectTrace
- type KnowledgeGaps
- type NodeCentrality
- type Question
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComputeBetweenness ¶
ComputeBetweenness computes approximate betweenness centrality using Brandes' Algorithm.
func ComputePageRank ¶
func ComputePageRank(nodes []graph.Node, edges []graph.Edge, damping float64, iterations int) map[graph.NodeID]float64
ComputePageRank computes PageRank scores over directed calls/implements/consumes/imports edges.
func DetectCyclesReport ¶
DetectCyclesReport is like DetectCycles but also returns resolution coverage.
Types ¶
type Community ¶
type Community struct {
ID string `json:"id"`
Name string `json:"name"` // Label derived from dominant node hub
Cohesion float64 `json:"cohesion"` // Edge density: 2 * E_in / (V * (V - 1))
NodeIDs []graph.NodeID `json:"node_ids"`
}
Community represents a detected structural cluster in the graph.
func DetectCommunities ¶
DetectCommunities partitions resolved dependency-view nodes into communities using Label Propagation. KindSymbol and KindImport are excluded; only file/module/function/type/method nodes that appear in resolved edges participate.
type Coverage ¶
type Coverage struct {
ImportEdgesTotal int `json:"import_edges_total"`
ImportEdgesResolved int `json:"import_edges_resolved"`
CallEdgesTotal int `json:"call_edges_total"`
CallEdgesResolved int `json:"call_edges_resolved"`
Notes []string `json:"notes,omitempty"`
}
Coverage describes what dependency resolution could and could not establish.
func (Coverage) Incomplete ¶
Incomplete reports whether any import or call edges remain unresolved.
type Cycle ¶
type Cycle struct {
Type string `json:"type"` // e.g. "import_cycle", "call_cycle"
Length int `json:"length"`
Path []graph.NodeID `json:"path"`
}
Cycle represents a circular dependency loop.
type DependencyView ¶
type DependencyView struct {
Nodes []graph.Node
Edges []graph.Edge // only resolved deps between files/modules (and resolved calls between defs)
Coverage Coverage
}
DependencyView is a filtered graph of resolved file/module relationships.
func BuildDependencyView ¶
func BuildDependencyView(nodes []graph.Node, edges []graph.Edge) DependencyView
BuildDependencyView constructs a single-repo analysis view of resolvable local imports and resolved call targets. Raw graph exports are left unchanged.
type IndirectTrace ¶
type IndirectTrace struct {
From string `json:"from"`
To string `json:"to"`
Hops int `json:"hops"`
Path []graph.NodeID `json:"path"`
}
IndirectTrace represents a multi-hop call/dependency chain across namespaces or modules.
func FindIndirectTraces ¶
FindIndirectTraces discovers indirect call chains (length >= 2 hops) between distinct modules/files, traversing only resolved call edges from the dependency view.
type KnowledgeGaps ¶
type KnowledgeGaps struct {
IsolatedNodes []graph.NodeID `json:"isolated_nodes"`
ThinCommunities []string `json:"thin_communities"`
}
KnowledgeGaps holds summary of orphan nodes and thin communities.
func AnalyzeKnowledgeGaps ¶
func AnalyzeKnowledgeGaps(nodes []graph.Node, edges []graph.Edge, communities []Community) KnowledgeGaps
AnalyzeKnowledgeGaps finds isolated nodes (<=1 edge) and thin clusters.
type NodeCentrality ¶
type NodeCentrality struct {
ID graph.NodeID `json:"id"`
Kind string `json:"kind"`
Name string `json:"name"`
Path string `json:"path"`
PageRank float64 `json:"pagerank"`
Betweenness float64 `json:"betweenness"`
}
NodeCentrality holds centrality scores for a single node.
func RankCentrality ¶
RankCentrality returns top N nodes sorted by PageRank score, scored only over the resolved dependency view. KindSymbol and KindImport never appear as God Nodes.
type Question ¶
Question represents an auto-generated architectural navigation or refactoring question.
func GenerateQuestions ¶
func GenerateQuestions(nodes []graph.Node, communities []Community, centralities []NodeCentrality, cycles []Cycle, coverage Coverage) []Question
GenerateQuestions programmatically creates navigation questions based on topological metrics. coverage qualifies advice when import/call resolution is incomplete.