graph

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 29, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

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"`
	Type        RelationType `json:"type"`
	Description string       `json:"description,omitempty"`
}

type Graph

type Graph struct {
	Nodes map[string]*Node `json:"nodes"`
	Edges []*Edge          `json:"edges"`
}

func New

func New() *Graph

func (*Graph) AddEdge

func (g *Graph) AddEdge(source, target string, relType RelationType, description string)

func (*Graph) AddNode

func (g *Graph) AddNode(id string, nType NodeType, name, description string)

func (*Graph) FormatCompact

func (g *Graph) FormatCompact() string

FormatCompact returns a compact string representation of the graph suitable for an LLM context.

func (*Graph) Subgraph

func (g *Graph) Subgraph(nodeID string) *Graph

Subgraph returns a new Graph containing the center node and all directly connected neighbors and edges.

type Node

type Node struct {
	ID          string   `json:"id"`
	Type        NodeType `json:"type"`
	Name        string   `json:"name"`
	Description string   `json:"description,omitempty"`
}

type NodeType

type NodeType string
const (
	NodeSkill    NodeType = "skill"
	NodeTool     NodeType = "tool"
	NodeResource NodeType = "resource"
)

type RelationType

type RelationType string
const (
	RelHasTool         RelationType = "HAS_TOOL"
	RelPrerequisiteFor RelationType = "PREREQUISITE_FOR"
	RelProduces        RelationType = "PRODUCES"
	RelRequires        RelationType = "REQUIRES"
	RelCommonNextStep  RelationType = "COMMON_NEXT_STEP"
)

Jump to

Keyboard shortcuts

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