Documentation
¶
Index ¶
- type Direction
- type Edge
- type EdgeID
- type Graph
- func (g *Graph) CreateEdge(edgeType string, from, to NodeID, props map[string]any) (EdgeID, error)
- func (g *Graph) CreateNode(label, key string, props map[string]any) (NodeID, error)
- func (g *Graph) DeleteEdge(id EdgeID) error
- func (g *Graph) DeleteNode(id NodeID) error
- func (g *Graph) EdgeCount() int
- func (g *Graph) EdgeTypeName(id uint16) string
- func (g *Graph) EdgesByType(edgeType string) []EdgeID
- func (g *Graph) GetEdge(id EdgeID) *Edge
- func (g *Graph) GetNode(id NodeID) *Node
- func (g *Graph) GetNodeByKey(key string) (*Node, bool)
- func (g *Graph) LabelName(id uint16) string
- func (g *Graph) Neighbors(id NodeID, edgeType string, dir Direction) []NodeID
- func (g *Graph) NodeCount() int
- func (g *Graph) NodesByLabel(label string) []NodeID
- func (g *Graph) Schema() *schema.Schema
- func (g *Graph) SetProperty(id NodeID, key string, value any) error
- func (g *Graph) ShortestPath(from, to NodeID) []NodeID
- func (g *Graph) Traverse(start NodeID, edgeType string, dir Direction, minHops, maxHops int) []NodeID
- type Node
- type NodeID
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Graph ¶
type Graph struct {
// contains filtered or unexported fields
}
Graph is the top-level in-memory property graph.
func (*Graph) CreateEdge ¶
CreateEdge creates a new edge between two nodes.
func (*Graph) CreateNode ¶
CreateNode creates a new node. If a node with the same key exists, it upserts (merges properties).
func (*Graph) DeleteNode ¶
DeleteNode removes a node and all its connected edges.
func (*Graph) EdgeTypeName ¶
EdgeTypeName returns the string name for an edge type ID.
func (*Graph) EdgesByType ¶
EdgesByType returns all edge IDs with the given type.
func (*Graph) GetNodeByKey ¶
GetNodeByKey returns a node by its unique key.
func (*Graph) Neighbors ¶
Neighbors returns node IDs connected to the given node via edges of the specified type and direction. If edgeType is empty, all edge types are matched.
func (*Graph) NodesByLabel ¶
NodesByLabel returns all node IDs with the given label.
func (*Graph) SetProperty ¶
SetProperty sets a property on a node.
func (*Graph) ShortestPath ¶
ShortestPath finds the shortest path between two nodes using BFS. Returns the path as a slice of node IDs (including start and end), or nil if no path exists.
func (*Graph) Traverse ¶
func (g *Graph) Traverse(start NodeID, edgeType string, dir Direction, minHops, maxHops int) []NodeID
Traverse performs a variable-length traversal from a start node. It follows edges of the given type (or all if empty) up to maxHops. Returns all unique node IDs reached (excluding the start node).