graph

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsAcyclic

func IsAcyclic(edgeType string) bool

IsAcyclic returns true if the edge type enforces DAG constraint.

func IsValidEdgeType

func IsValidEdgeType(t string) bool

IsValidEdgeType reports whether t is a recognized edge type.

Types

type Graph

type Graph interface {
	AddNode(ctx context.Context, n *storage.Node) error
	AddEdge(ctx context.Context, e *storage.Edge) error
	RemoveNode(ctx context.Context, id string) error
	RemoveEdge(ctx context.Context, id string) error
	ExtractSubgraph(ctx context.Context, startID string, maxDepth int) (*Subgraph, error)
	BFS(ctx context.Context, startID string, maxDepth int) ([]string, error)
	IntentBFS(ctx context.Context, startID string, maxDepth int, queryIntent intent.Intent) ([]string, error)
	Impact(ctx context.Context, filePath string, maxDepth int) ([]string, error)
	Ancestors(ctx context.Context, id string) ([]string, error)
	Descendants(ctx context.Context, id string) ([]string, error)
}

Graph is the interface for all graph operations used by Engine.

func New

func New(store storage.Storage, db *sql.DB) Graph

New creates a Graph engine backed by the given Store and raw DB connection. The db handle is used for recursive CTE queries (BFS, cycle detection, ancestors, descendants, impact) that cannot be expressed through the Storage interface without leaking SQL details.

type Subgraph

type Subgraph struct {
	Nodes []*storage.Node
	Edges []*storage.Edge
}

Subgraph holds a set of nodes and edges.

Jump to

Keyboard shortcuts

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