Documentation
¶
Index ¶
- Constants
- func FileID(scopeRepo, scopeModule, scopeService, file string) string
- func NodeID(parts ...string) string
- func SymbolID(scopeRepo, scopeModule, scopeService, file, symbolName string) string
- type Edge
- type Graph
- func (g *Graph) AddEdge(from, to, kind string)
- func (g *Graph) AddNode(id, kind string) *Node
- func (g *Graph) Children(id string) []string
- func (g *Graph) Edges() []Edge
- func (g *Graph) HasNode(id string) bool
- func (g *Graph) InEdges(to string) []Edge
- func (g *Graph) Merge(other *Graph)
- func (g *Graph) Name() string
- func (g *Graph) Node(id string) *Node
- func (g *Graph) Nodes() []*Node
- func (g *Graph) OutEdges(from string) []Edge
- func (g *Graph) Parents(id string) []string
- func (g *Graph) Print(verb string) string
- func (g *Graph) ReachableFrom(fromID, toID string) bool
- func (g *Graph) SetAttr(id, kind, key string, value any)
- func (g *Graph) SubgraphFrom(startID string) (*Graph, error)
- func (g *Graph) TopologicalSort() ([]string, error)
- type Node
Constants ¶
const ( KindRepo = "repo" KindModule = "module" KindService = "service" KindFile = "file" KindSymbol = "symbol" KindEndpoint = "endpoint" )
NodeKind is the type of a node in the graph (cross-repo, cross-language).
const ( EdgeDependsOn = "depends_on" EdgeContains = "contains" EdgeCalls = "calls" EdgeReferences = "references" EdgeChildOf = "child_of" )
EdgeKind is the type of an edge (dependency, containment, call, etc.).
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Graph ¶
type Graph struct {
// contains filtered or unexported fields
}
Graph is a generic directed graph of nodes and edges for dependency trees and LSP-derived relationships. Use it for service dependencies, module graphs, symbol trees, and call/reference edges.
func (*Graph) AddEdge ¶
AddEdge adds a directed edge. Creates nodes if they do not exist (with empty kind).
func (*Graph) Merge ¶
Merge merges another graph into g. Node IDs must be unique; same ID overwrites (kind/attrs).
func (*Graph) ReachableFrom ¶
ReachableFrom returns true if toID is reachable from fromID.
func (*Graph) SubgraphFrom ¶
SubgraphFrom returns a new graph containing all nodes reachable from startID (following edges).
func (*Graph) TopologicalSort ¶
TopologicalSort returns node IDs in topological order (no cycle check; use on DAGs).