Documentation
¶
Overview ¶
Package model holds the graph data types shared across the pipeline: the extraction schema (nodes + edges) emitted by extractors and the assembled undirected Graph that downstream stages cluster, analyze, and export.
Index ¶
- type Edge
- type Extraction
- type Graph
- func (g *Graph) AddEdge(e Edge)
- func (g *Graph) AddNode(n Node)
- func (g *Graph) Degree(id string) int
- func (g *Graph) Edges() []*Edge
- func (g *Graph) HasEdge(a, b string) bool
- func (g *Graph) Neighbors(id string) []string
- func (g *Graph) NodeIDs() []string
- func (g *Graph) NumEdges() int
- func (g *Graph) NumNodes() int
- type Node
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Edge ¶
type Edge struct {
Source string `json:"source"`
Target string `json:"target"`
Relation string `json:"relation"`
Confidence string `json:"confidence"`
SourceFile string `json:"source_file,omitempty"`
SourceLocation string `json:"source_location,omitempty"`
Weight float64 `json:"weight,omitempty"`
ConfidenceScore float64 `json:"confidence_score,omitempty"`
}
Edge is a directed relationship between two nodes. The graph stores edges undirected (so community detection and degree work), but Source/Target always record the true direction (caller→callee, importer→imported).
type Extraction ¶
Extraction is one extractor's output for one file.
type Graph ¶
Graph is the assembled knowledge graph. It keeps the full directed edge list (so a→b and b→a, or two different relations on one pair, both survive) plus an undirected neighbour set used for degree, traversal, and community detection.
func (*Graph) AddEdge ¶
AddEdge records a directed edge between existing nodes. Exact duplicates (same source, target, and relation) are ignored; opposite directions and different relations on the same pair are all kept.
func (*Graph) AddNode ¶
AddNode inserts or overwrites a node (last write wins, mirroring nx.add_node).
func (*Graph) Neighbors ¶
Neighbors returns a node's neighbor IDs in sorted order (stable iteration).
type Node ¶
type Node struct {
ID string `json:"id"`
Label string `json:"label"`
FileType string `json:"file_type"`
SourceFile string `json:"source_file"`
SourceLocation string `json:"source_location,omitempty"`
ComputedName string `json:"computed_name,omitempty"`
}
Node is a single entity in the graph (a file, function, type, or method).