DHART
|
Functions for finding the shortest path between two nodes in a graph. More...
Static Public Member Functions | |
static Path | DijkstraShortestPath (Graph graph, int start_id, int end_id, string cost_type="") |
Perform Dijkstra's shortest path algorithm to find a path between two nodes. More... | |
static Path | DijkstraShortestPath (Graph graph, Vector3D start_node, Vector3D end_node, string cost_type="") |
Perform Dijkstra's shortest path algorithm to find a path between two nodes. More... | |
static Path[] | DijkstraShortestPathMulti (Graph graph, int[] start_ids, int[] end_ids, string cost_type="") |
Find the shortest paths between each pair of start_id and end_id in order. More... | |
static Path[] | DijkstraShortestPathMulti (Graph graph, IEnumerable< Vector3D > start_nodes, IEnumerable< Vector3D > end_nodes, string cost_type="") |
Find the shortest paths between each pair of start_id and end_id in order. More... | |
static Path[] | DijkstraAllToAll (Graph g, string cost_type="") |
Generate a path from every node in the graph to every other node in a graph. More... | |
static void | GeneratePredecessorAndDistanceMatricies (Graph g, out UnmanagedFloatArray2D out_dist, out UnmanagedIntArray2D out_predecessor, string cost_type="") |
Calculate Predecessor and Distance Matricies for a graph. More... | |
Functions for finding the shortest path between two nodes in a graph.
|
static |
Generate a path from every node in the graph to every other node in a graph.
g | The graph to generate paths in. |
cost_type | Type of cost to use for path generation. If left blank will use the default cost of the graph |
g
squared. Paths will be returned in order starting with all paths from node 0, then all paths from node 1, etc. If a path could not be generated between a set of nodes, then path at that index will be null.cost_type
is not left as the default, then it must be the name of a valid cost already defined in graph
.KeyNotFoundException | cost_type wasn't left as blank, and didn't refer to the name of any cost that already exists in graph . |
References DHARTAPI.SpatialStructures.Graph.NumNodes().
|
static |
Perform Dijkstra's shortest path algorithm to find a path between two nodes.
graph | The graph to conduct the search on. |
start_id | The ID of the node to start at. |
end_id | The ID of the node to find a path to. |
cost_type | The type of cost to use for generating the path. If left blank, will use the cost that the graph was created with. In the case of the graph generator, the default cost is distance. |
start_id
and end_id
must be the X,Y,Z position of nodes that already exist in graph
. cost_type
is not left as the default, then it must be the name of a valid cost already defined in graph
.KeyNotFoundException | cost_type wasn't left as blank, and didn't refer to the name of any cost that already exists in the graph. |
Referenced by DHARTAPI.Pathfinding.ShortestPath.DijkstraShortestPath(), and StringToEdgeCost.Main().
|
static |
Perform Dijkstra's shortest path algorithm to find a path between two nodes.
graph | The graph to conduct the search on. |
start_node | The X,Y,Z of a node in the graph node to start at. |
end_node | The X,Y,Z of a node in the graph node to end at. |
cost_type | The type of cost to use for generating the path. If left blank, will use the cost that the graph was created with. In the case of the graph generator, the default cost is distance. |
start_node
and end_node
must be the X,Y,Z position of nodes that already exist in graph
. cost_type
is not left as the default, then it must be the name of a valid cost already defined in graph
.KeyNotFoundException | cost_type wasn't left as blank, and didn't refer to the name of any cost that already exists in the graph. |
References DHARTAPI.Pathfinding.ShortestPath.DijkstraShortestPath(), and DHARTAPI.SpatialStructures.Graph.GetNodeID().
|
static |
Find the shortest paths between each pair of start_id and end_id in order.
graph | The graph to generate paths in. |
start_nodes | Locations of the start points to generate paths from. |
end_nodes | Locations of the end nodes to generate paths to. |
cost_type | The type of cost to use for generating the path. If left blank, will use the cost that the graph was created with. In the case of the graph generator, the default cost is distance. |
start_ids
to end_ids
. If a path could not be generated by a set of points, then the path at that location will be null.Determines the IDs of nodes, then calls the other overload. Uses all available cores for parallel calculation.
start_ids
must match the length of end_ids
. start_nodes
and end_nodes must contain the x,y,z position of an existing node in graph
cost_type
is not left as the default, then it must be the name of a valid cost already defined in graph
.System.ArgumentException | Length of start_ids didn't equal length of end_ids |
KeyNotFoundException | cost_type wasn't left as blank, and didn't refer to the name of any cost that already exists in graph . |
References DHARTAPI.Pathfinding.ShortestPath.DijkstraShortestPathMulti().
|
static |
Find the shortest paths between each pair of start_id and end_id in order.
graph | The graph to generate paths in. |
start_ids | Ids for the start points to generate paths from. |
end_ids | Ids for the end points to generate paths to |
cost_type | The type of cost to use for generating the path. If left blank, will use the cost that the graph was created with. In the case of the graph generator, the default cost is distance. |
start_ids
and end_ids
must be the ID of some node in graph
. cost_type
is not left as the default, then it must be the name of a valid cost already defined in graph
.Uses all available cores for parallel calculation.
System.ArgumentException | Length of start_ids didn't equal length of end_ids |
KeyNotFoundException | cost_type wasn't left as blank, and didn't refer to the name of any cost that already exists in the graph. |
Referenced by DHARTAPI.Pathfinding.ShortestPath.DijkstraShortestPathMulti().
|
static |
Calculate Predecessor and Distance Matricies for a graph.
g | Graph to calculate predeessor and distance matricies for |
out_dist | Output parameter for the distance matrix |
out_predecessor | Output parameter for the predecessor matrix. |
cost_type | Type of cost to use for the distance and predecessor matricies. If left blank will use the default cost of the graph. |
KeyNotFoundException | If cost_type isn't left to the default, and does not match the key of any cost that already exists in the graph. |
g
.[0, 15, 10, NaN, 0, NaN, NaN, 5, 0]
[0, 2, 0, -1, 1, -1, -1, 2, 2]
References DHARTAPI.SpatialStructures.Graph.NumNodes().