graph

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetNeighbors

func GetNeighbors(ctx context.Context, db GraphDB, chunkID uuid.UUID, edgeTypes []model.EdgeType, followBidirectional bool) ([]*model.Chunk, error)

GetNeighbors retrieves immediate neighbors (1-hop) of a chunk

Types

type GraphDB

type GraphDB interface {
	GetChunk(ctx context.Context, id string) (*model.Chunk, error)
	GetEdgesFromChunk(ctx context.Context, chunkID string, edgeTypes []model.EdgeType, followBidirectional bool) ([]*model.Edge, error)
}

GraphDB defines the interface for graph operations

type TraversalResult

type TraversalResult struct {
	Chunk    *model.Chunk
	Distance int
	Path     []uuid.UUID // Path from source to this chunk
}

TraversalResult contains a chunk and its distance from the source

func BFS

func BFS(ctx context.Context, db GraphDB, sourceID uuid.UUID, maxHops int, edgeTypes []model.EdgeType, followBidirectional bool) ([]*TraversalResult, error)

BFS performs breadth-first search from a source chunk

func DFS

func DFS(ctx context.Context, db GraphDB, sourceID uuid.UUID, maxHops int, edgeTypes []model.EdgeType, followBidirectional bool) ([]*TraversalResult, error)

DFS performs depth-first search from a source chunk

Jump to

Keyboard shortcuts

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