Versions in this module Expand all Collapse all v1 v1.22.78 Jan 1, 2026 Changes in this version + const GasBFSBase + const GasBFSPerNode + const GasConnectedComponents + const GasCreateEdge + const GasCreateNode + const GasDFSBase + const GasDFSPerNode + const GasDeleteEdge + const GasDeleteNode + const GasGetCount + const GasGetEdge + const GasGetNode + const GasHasCycle + const GasQueryBase + const GasQueryPerItem + const GasShortestPath + const GasSubgraphMatch + const GasTriangleCount + const GasUpdateEdge + const GasUpdateNode + var ErrCyclicGraph = errors.New("cyclic graph detected where not allowed") + var ErrDuplicateEdge = errors.New("duplicate edge") + var ErrDuplicateNode = errors.New("duplicate node") + var ErrEdgeNotFound = errors.New("edge not found") + var ErrInvalidInput = errors.New("invalid input") + var ErrNodeNotFound = errors.New("node not found") + var ErrPatternInvalid = errors.New("invalid pattern") + var GraphPrecompileAddress = [20]byte + var SelectorBFS = [4]byte + var SelectorConnectedComponents = [4]byte + var SelectorCreateEdge = [4]byte + var SelectorCreateNode = [4]byte + var SelectorDFS = [4]byte + var SelectorDeleteEdge = [4]byte + var SelectorDeleteNode = [4]byte + var SelectorGetEdge = [4]byte + var SelectorGetEdgeCount = [4]byte + var SelectorGetIncomingEdges = [4]byte + var SelectorGetNode = [4]byte + var SelectorGetNodeCount = [4]byte + var SelectorGetOutgoingEdges = [4]byte + var SelectorHasCycle = [4]byte + var SelectorQueryEdgesByLabel = [4]byte + var SelectorQueryNodesByLabel = [4]byte + var SelectorShortestPath = [4]byte + var SelectorSubgraphMatch = [4]byte + var SelectorTriangleCount = [4]byte + var SelectorUpdateEdge = [4]byte + var SelectorUpdateNode = [4]byte + func BytesToUint64(b []byte) uint64 + func Uint64ToBytes(n uint64) []byte + type Edge struct + From NodeID + ID EdgeID + Label string + Properties map[string][]byte + To NodeID + func DeserializeEdge(data []byte) (*Edge, error) + func (e *Edge) Serialize() ([]byte, error) + type EdgeID [32]byte + func GenerateEdgeID(from, to NodeID, label string) EdgeID + func ParseEdgeID(data []byte) (EdgeID, error) + type GraphContract struct + func NewGraphContract(db database.Database) *GraphContract + func (c *GraphContract) RequiredGas(input []byte) uint64 + func (c *GraphContract) Run(input []byte) ([]byte, error) + type GraphStorage struct + func NewGraphStorage(db database.Database) *GraphStorage + func (s *GraphStorage) BFS(startID NodeID, opts TraversalOptions) ([]TraversalResult, error) + func (s *GraphStorage) ConnectedComponents() (int, error) + func (s *GraphStorage) CreateEdge(edge *Edge) error + func (s *GraphStorage) CreateNode(node *Node) error + func (s *GraphStorage) DFS(startID NodeID, opts TraversalOptions) ([]TraversalResult, error) + func (s *GraphStorage) DeleteEdge(id EdgeID) error + func (s *GraphStorage) DeleteNode(id NodeID) error + func (s *GraphStorage) GetEdge(id EdgeID) (*Edge, error) + func (s *GraphStorage) GetEdgeCount() (uint64, error) + func (s *GraphStorage) GetIncomingEdges(nodeID NodeID) ([]*Edge, error) + func (s *GraphStorage) GetNode(id NodeID) (*Node, error) + func (s *GraphStorage) GetNodeCount() (uint64, error) + func (s *GraphStorage) GetOutgoingEdges(nodeID NodeID) ([]*Edge, error) + func (s *GraphStorage) HasCycle(startID NodeID) (bool, error) + func (s *GraphStorage) QueryEdgesByLabel(label string) ([]*Edge, error) + func (s *GraphStorage) QueryNodesByLabel(label string) ([]*Node, error) + func (s *GraphStorage) ReachableNodes(startID NodeID, opts TraversalOptions) ([]NodeID, error) + func (s *GraphStorage) ShortestPath(fromID, toID NodeID, opts TraversalOptions) ([]NodeID, error) + func (s *GraphStorage) SubgraphMatch(pattern SubgraphPattern, maxResults int) ([]MatchResult, error) + func (s *GraphStorage) TriangleCount() (uint64, error) + type MatchResult struct + Bindings map[string]NodeID + type Node struct + ID NodeID + Label string + Properties map[string][]byte + func DeserializeNode(data []byte) (*Node, error) + func (n *Node) Serialize() ([]byte, error) + type NodeID [32]byte + func GenerateNodeID(data []byte) NodeID + func ParseNodeID(data []byte) (NodeID, error) + type PatternEdge struct + FromVar string + Label string + Properties map[string][]byte + ToVar string + type PatternNode struct + Label string + Properties map[string][]byte + Var string + type SubgraphPattern struct + Edges []PatternEdge + Nodes []PatternNode + type TraversalDirection int + const DirectionBoth + const DirectionIncoming + const DirectionOutgoing + type TraversalOptions struct + Direction TraversalDirection + EdgeLabel string + MaxDepth int + MaxNodes int + func DefaultTraversalOptions() TraversalOptions + type TraversalResult struct + Depth int + Path []NodeID