graph

package
v0.0.0-...-aeb4a1d Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteEdge

func DeleteEdge(stub cached_stub.CachedStubInterface, graphName string, startNodeId string, targetNodeId string) error

DeleteEdge deletes an edge value.

func GetDirectChildren

func GetDirectChildren(stub cached_stub.CachedStubInterface, graphName string, nodeId string) ([]string, error)

GetDirectChildren returns the immediate children of the given nodeId

func GetDirectParents

func GetDirectParents(stub cached_stub.CachedStubInterface, graphName string, nodeId string) ([]string, error)

GetDirectParents returns the immediate parents of the given nodeId

func GetEdge

func GetEdge(stub cached_stub.CachedStubInterface, graphName string, startNodeId string, targetNodeId string) ([]byte, map[string]string, error)

GetEdge gets an edge value and edge data given node ids. Returns edge value, edge data, error.

func GetFirstEdgeContainingNodeId

func GetFirstEdgeContainingNodeId(stub cached_stub.CachedStubInterface, graphName string, nodeId string) ([]byte, error)

GetFirstEdgeContainingNodeId returns the first edge value of edge that contains node id.

func HasEdge

func HasEdge(stub cached_stub.CachedStubInterface, graphName string, startNodeId string, targetNodeId string) (bool, error)

HasEdge checks if the edge exists in the graph.

func HasPath

func HasPath(stub cached_stub.CachedStubInterface, graphName string, path []string) (bool, error)

HasPath checks if the path exists in the graph. The existence of a path from an id to the same id will return true.

func PutEdge

func PutEdge(stub cached_stub.CachedStubInterface, graphName string, startNodeId string, targetNodeId string, edge ...interface{}) error

PutEdge updates an existing edge or adds an edge if it does not exist. edge is an edgeValue ([]byte), and edgeData is a map[string]string (optional)

func SlowFindPath

func SlowFindPath(stub cached_stub.CachedStubInterface, graphName string, startNodeId string, targetNodeId string, filterRule ...interface{}) ([]string, error)

SlowFindPath finds the first path in the graph from startNodeId to targetNodeId. Uses recursive DFS. If no path is found, returns nil.

func SlowGetChildren

func SlowGetChildren(stub cached_stub.CachedStubInterface, graphName string, nodeId string, filter ...interface{}) ([]string, error)

SlowGetChildren gets all children in the graph

func SlowGetParents

func SlowGetParents(stub cached_stub.CachedStubInterface, graphName string, nodeId string, filter ...interface{}) ([]string, error)

SlowGetParents gets all parents in the graph

Types

type Edge

type Edge struct {
	EdgeValue []byte            `json:"edge_value"`
	EdgeData  map[string]string `json:"edge_data"`
}

Jump to

Keyboard shortcuts

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