Traversal
Each running dynamic map in the agent provides graph traversal services, found under dynamicMaps/<dynamicMapName>/traversal/spatial, as shown in the live data viewer image below.

The services share two parameters which restrict which parts of the graph can be used by a traversal. Each is an object keyed by type, so that a traversal can be limited to certain node and edge types:
nodeTypes: The node types the process is allowed to use for graph traversal. Each key is a node type, with an empty object as its value. If not provided, the traversal will be unrestricted.edgeTypes: The edge types the process is allowed to use for graph traversal. Each key is an edge type, and its value is an object with adirectedboolean. Ifdirectedistruethe edge can only be traversed from itsfromnode to itstonode; otherwise it can be traversed in either direction. If not provided, the traversal will be unrestricted.
For example, to traverse only between bd.spot.waypoint.v1 nodes, along bd.spot.traversable.v1 edges in either direction:
{
"nodeTypes": { "bd.spot.waypoint.v1": {} },
"edgeTypes": { "bd.spot.traversable.v1": { "directed": false } }
}
findNearestNeighbor
Request
startNodeId: The ID of the node from which to start the search.neighbors: A list of node IDs. The nearest node from this list to thestartNodeIdis returned.nodeTypes: The node types the process is allowed to use for graph traversal, as described above.edgeTypes: The edge types the process is allowed to use for graph traversal, as described above.reportData: A boolean value that specifies whether the node data should be included in the response. The default isfalse.reportEdges: A boolean value that specifies whether the edges of the node should be included in the response. The default isfalse.
Response
The nearest neighbor to the startNodeId from the list of neighbors is returned.
An example response is shown in the image below.
Here the traversal has been set up to only traverse between bd.spot.waypoint.v1 nodes and only along bd.spot.traversable.v1 edges.

lookupTransform
Request
parentId: The ID of the parent node.childId: The ID of the child node.format: The format in which the transform is returned. Either"transform", the DroneDeploy transform format of a positionx,y,zand a rotation quaternionx,y,z,w, or"matrix", a 4x4 homogeneous transform matrix.
Response
The transform from the parentId to the childId is returned. An example of this is shown in the image below:

shortestPath
The shortestPath service uses Dijkstras's algorithm to find the shortest path from a start node to a desired destination node.
Request
startNodeId: The ID of the node from which to start the search.endNodeId: The ID of the desired destination node.nodeTypes: The node types the process is allowed to use for graph traversal, as described above.edgeTypes: The edge types the process is allowed to use for graph traversal, as described above.reportData: A boolean value that specifies whether the node data should be included in the response. The default isfalse.
Response
- An object containing:
path: The shortest path fromstartNodeIdtoendNodeIdis returned. An example of this is shown in the image below.

sortByShortestPath
The sortByShortestPath service returns an approximate shortest path traversing from a start node to a list of visit nodes. It does this by first solving the Travelling Salesman Problem (TSP) using a simple Nearest Neighbor approach. If refinement is enabled, the path is then refined using an approach called Simulated Annealing.
Request
startNodeId: The ID of the node from which to start the search.visitNodeIds: A list of node IDs to visit.nodeTypes: The node types the process is allowed to use for graph traversal, as described above.edgeTypes: The edge types the process is allowed to use for graph traversal, as described above.reportData: A boolean value that specifies whether the node data should be included in the response. The default isfalse.refinement: An object which selects and controls refinement of the path. Refinement is off unlessenabledistrue. Refinement settings are outlined here: Path Refinement.
Response
- An object containing:
path: The approximate shortest path traversing fromstartNodeIdto allvisitNodeIdsis returned. An example of this is shown in the image below.refinement: If refinement is enabled, the refinement results are provided.

Path Refinement with Simulated Annealing
The sort by shortest path service returns an approximate solution to the Travelling Salesman Problem (TSP). By providing only an approximate solution, a response to this service can be returned in a reasonable amount of time, even for large maps. Simulated Annealing is used to refine the initial solution created from the simple Nearest Neighbor approach.
Simulated Annealing involves iteratively swapping two edges in the path. If the new path is shorter, we accept this solution and continue. If the new path is longer, we accept it with a probability that decreases over time. This allows the algorithm to escape local minima and potentially find a better solution as the algorithm progresses.
The probability of accepting a worse solution is given by the following equation:
Where is the temperature of the system. The temperature is decreased by a cooling rate with each accepted path.
The sort by shortest path service provides the following parameters to control the refinement process. They are given in the refinement object of the request:
enabled: A boolean value that specifies whether the path should be refined. The default isfalse.params: An object containing the settings of the annealing process:startTemperature: The initial temperature of the system. The default is2.0.exitTemperature: The temperature at which the system should stop refining. The default is0.00001.coolingRate: The rate at which the temperature decreases. The default is0.9995.
Example
{
"startNodeId": "waypoint-0",
"visitNodeIds": ["waypoint-4", "waypoint-7", "waypoint-2"],
"refinement": {
"enabled": true,
"params": { "startTemperature": 2.0, "coolingRate": 0.9995 }
}
}