Documentation ¶
Index ¶
- Variables
- type Adj
- type AstSchema
- type Graph
- func (g *Graph) AddEdge(from *Node, to *Adj)
- func (g *Graph) AddNode(node *Node)
- func (g *Graph) GetAdjacenciesSortedByName(node *Node) []*Adj
- func (g *Graph) GetAdjacency(node *Node) []*Adj
- func (g *Graph) GetLeafNodes() []*Node
- func (g *Graph) GetNodeByName(name string) *Node
- func (g *Graph) GetNodesSortedByName() []*Node
- func (g *Graph) TopologicalSort() []*Node
- type Node
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrGoModNotFound = errors.New("go mod not found")
Functions ¶
This section is empty.
Types ¶
type Graph ¶ added in v0.3.0
type Graph struct { Nodes []*Node // A slice of pointers to all the nodes in the graph Adj map[*Node][]*Adj // An adjacency list mapping each node to its adjacent nodes NodeByName map[string]*Node // A hash map to store nodes by their names NodesByPackage map[string][]*Node // A hash map to store nodes by their packages }
Graph represents the dependency graph.
func (*Graph) AddEdge ¶ added in v0.3.0
AddEdge adds a directed edge between two nodes in the graph.
func (*Graph) GetAdjacenciesSortedByName ¶ added in v0.3.0
GetAdjacenciesSortedByName returns the adjacencies sorted by the adjacent node names.
func (*Graph) GetAdjacency ¶ added in v0.3.0
func (*Graph) GetLeafNodes ¶ added in v0.3.0
GetLeafNodes returns all the leaf nodes. A leaf node is a node without any inbound nodes.
func (*Graph) GetNodeByName ¶ added in v0.3.0
GetNodeByName finds a node by its name in the graph.
func (*Graph) GetNodesSortedByName ¶ added in v0.3.0
GetNodesSortedByName returns all nodes sorted by node name.
func (*Graph) TopologicalSort ¶ added in v0.3.0
TopologicalSort performs a topological sort on the graph.
type Node ¶ added in v0.3.0
type Node struct { Name string // The fully qualified name of the struct, PackageName.StructName PackageName string StructName string Methods []struct_decl.Method Doc string External bool InboundEdges []*Node ActualNamedType *types.Named P *packages.Package FilePath string }
Node represents a node of the dependency graph.
func (*Node) MergeAdditionalFields ¶ added in v0.3.0
Click to show internal directories.
Click to hide internal directories.