apoc.algo.aStar

Details

Syntax

apoc.algo.aStar(startNode, endNode, relTypesAndDirections, weightPropertyName, latPropertyName, lonPropertyName) :: (path, weight)

Description

Runs the A* search algorithm to find the optimal path between two NODE values, using the given RELATIONSHIP property name for the cost function.

Input arguments

Name

Type

Description

startNode

NODE

The node to start the search from.

endNode

NODE

The node to end the search on.

relTypesAndDirections

STRING

The relationship types to restrict the algorithm to. Relationship types are represented using APOC’s rel-direction-pattern syntax; [<]RELATIONSHIP_TYPE1[>]|[<]RELATIONSHIP_TYPE2[>]|…​.

weightPropertyName

STRING

The name of the property to use as the weight.

latPropertyName

STRING

The name of the property to use as the latitude.

lonPropertyName

STRING

The name of the property to use as the longitude.

Return arguments

Name

Type

Description

path

PATH

The path result.

weight

FLOAT

The weight of the given path.