Documentation
¶
Overview ¶
Package path provides APOC path finding functions.
This package implements all apoc.path.* functions for finding and analyzing paths in graph queries.
Index ¶
- func Elements(path *Path) []interface{}
- type Config
- type Functions
- func (f *Functions) AllShortestPaths(ctx context.Context, start, end *Node, relFilter string, maxHops int) ([]*Path, error)
- func (f *Functions) ExpandConfig(ctx context.Context, start *Node, config Config) ([]*Path, error)
- func (f *Functions) ShortestPath(ctx context.Context, start, end *Node, relFilter string, maxHops int) (*Path, error)
- func (f *Functions) SpanningTree(ctx context.Context, start *Node, config Config) ([]*Path, error)
- func (f *Functions) SubgraphAll(ctx context.Context, start *Node, config Config) (map[string]interface{}, error)
- func (f *Functions) SubgraphNodes(ctx context.Context, start *Node, config Config) ([]*Node, error)
- type Node
- type Path
- type Relationship
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
MinLevel int
MaxLevel int
RelationshipFilter string
LabelFilter string
Limit int
Unique string
BFS bool
}
Config holds path finding configuration.
type Functions ¶
type Functions struct {
// contains filtered or unexported fields
}
Functions binds this package's storage-dependent helpers to one storage backend. The backend is fixed when the instance is created, so a handler an already-admitted caller holds keeps the backend it was built for.
func New ¶
New returns this package's helpers bound to backend. One instance serves one backend; a reconfiguration builds a new instance instead of rebinding this one.
func (*Functions) AllShortestPaths ¶
func (f *Functions) AllShortestPaths(ctx context.Context, start, end *Node, relFilter string, maxHops int) ([]*Path, error)
AllShortestPaths finds all shortest paths between two nodes.
Example:
apoc.path.allShortestPaths(start, end, 'KNOWS>', 10)
func (*Functions) ExpandConfig ¶
ExpandConfig expands from a start node with configuration.
Example:
apoc.path.expandConfig(startNode, {relationshipFilter: 'KNOWS>'})
func (*Functions) ShortestPath ¶
func (f *Functions) ShortestPath(ctx context.Context, start, end *Node, relFilter string, maxHops int) (*Path, error)
ShortestPath finds the shortest path between two nodes.
Example:
apoc.path.shortestPath(start, end, 'KNOWS>', 10)
func (*Functions) SpanningTree ¶
SpanningTree finds a spanning tree from a start node.
Example:
apoc.path.spanningTree(startNode, {maxLevel: 5})
func (*Functions) SubgraphAll ¶
func (f *Functions) SubgraphAll(ctx context.Context, start *Node, config Config) (map[string]interface{}, error)
SubgraphAll returns nodes and relationships in the map keys "nodes" and "rels". Cancellation and backend failures return no partial map.
Example:
apoc.path.subgraphAll(startNode, {maxLevel: 3})
type Path ¶
Path represents a path through the graph.
type Relationship ¶
type Relationship = storage.Relationship
Relationship represents a graph relationship.