graph

package
v0.0.0-...-ae3ab5d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

Builder constructs code graphs from Go source code

func NewBuilder

func NewBuilder() *Builder

NewBuilder creates a new graph builder

func (*Builder) BuildFromFile

func (b *Builder) BuildFromFile(filePath string) (*Graph, error)

BuildFromFile builds a code graph from a single file

func (*Builder) BuildFromPath

func (b *Builder) BuildFromPath(projectPath string, includeTests bool) (*Graph, error)

BuildFromPath builds a code graph from a project path

type Exporter

type Exporter struct{}

Exporter exports code graphs to various formats

func NewExporter

func NewExporter() *Exporter

NewExporter creates a new exporter

func (*Exporter) ExportToDOT

func (e *Exporter) ExportToDOT(graph *Graph) (string, error)

ExportToDOT exports a graph to DOT format (Graphviz)

func (*Exporter) ExportToMermaid

func (e *Exporter) ExportToMermaid(graph *Graph) (string, error)

ExportToMermaid exports a graph to Mermaid format

type Graph

type Graph struct {
	Nodes       []codeintel.GraphNode  `json:"nodes"`
	Edges       []*codeintel.GraphEdge `json:"edges"`
	EntryPoints []string               `json:"entry_points"`
	Cycles      []string               `json:"cycles"`
}

Graph represents a code call graph

func (*Graph) Complexity

func (g *Graph) Complexity() float64

Complexity calculates the overall graph complexity

func (*Graph) FindNode

func (g *Graph) FindNode(nodeID string) *codeintel.GraphNode

FindNode finds a node by ID

func (*Graph) GetCalleesOf

func (g *Graph) GetCalleesOf(nodeID string) []codeintel.GraphNode

GetCalleesOf finds all functions called by the given function

func (*Graph) GetCallersOf

func (g *Graph) GetCallersOf(nodeID string) []codeintel.GraphNode

GetCallersOf finds all functions that call the given function

func (*Graph) Stats

func (g *Graph) Stats() *GraphStats

Stats returns statistics about the graph

type GraphStats

type GraphStats struct {
	TotalNodes    int     `json:"total_nodes"`
	TotalEdges    int     `json:"total_edges"`
	EntryPoints   int     `json:"entry_points"`
	Cycles        int     `json:"cycles"`
	FunctionCount int     `json:"function_count"`
	MethodCount   int     `json:"method_count"`
	TypeCount     int     `json:"type_count"`
	ExportedNodes int     `json:"exported_nodes"`
	AvgOutDegree  float64 `json:"avg_out_degree"`
	MaxOutDegree  int     `json:"max_out_degree"`
}

GraphStats represents statistics about a code graph

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL