Path Finder (2D/3D) 1.0.1
Create and use simple navigation graphs for 2D/3D path finding with choice of 4 search algorithms.
|
Public Member Functions | |
GraphSearch_DFS (Graph graph) | |
LinkedList< GraphNode > | search (int startID, int targetID) |
LinkedList< GraphNode > | search (int startID, int targetID, boolean remember) |
GraphEdge[] | getExaminedEdges () |
GraphNode[] | getRoute () |
LinkedList< GraphNode > | search (int startID, int targetID) |
LinkedList< GraphNode > | search (int startID, int targetID, boolean remember) |
GraphEdge[] | getExaminedEdges () |
public< T > T[] | getExaminedEdges (T[] array) |
GraphNode[] | getRoute () |
public< T > T[] | getRoute (T[] array) |
Protected Member Functions | |
GraphSearch_DFS () | |
Protected Attributes | |
Graph | graph |
HashSet< Integer > | visited |
HashMap< Integer, Integer > | settledNodes |
Stack< GraphEdge > | stack |
LinkedList< GraphNode > | route |
HashSet< GraphEdge > | examinedEdges |
Depth First Search
Objects of this class are used to search a graph and find a path between two nodes using this algorithm.
|
protected |
Prevent creating an object without a graph
pathfinder.GraphSearch_DFS.GraphSearch_DFS | ( | Graph | graph | ) |
Create a search object that uses depth first search algorithm for the given graph.
graph | the graph to use |
GraphEdge[] pathfinder.GraphSearch_DFS.getExaminedEdges | ( | ) |
Get all the edges examined during the search.
Implements pathfinder.IGraphSearch.
GraphNode[] pathfinder.GraphSearch_DFS.getRoute | ( | ) |
Get the path found as an array of GraphNode(s) in start->end order
Implements pathfinder.IGraphSearch.
LinkedList< GraphNode > pathfinder.GraphSearch_DFS.search | ( | int | startID, |
int | targetID | ||
) |
Search for a route from node startID and ends at targetID.
This will return a linkedlist of the nodes that make up the route from start to end order.
If either the start or target node does not exist or if a route can't be found the returned list is empty.
startID | id of the start node |
targetID | id of the target node |
Implements pathfinder.IGraphSearch.
LinkedList< GraphNode > pathfinder.GraphSearch_DFS.search | ( | int | startID, |
int | targetID, | ||
boolean | remember | ||
) |
Search for a route from node startID and ends at targetID.
This will return a linkedlist of the nodes that make up the route from start to end order.
If either the start or target node does not exist or if a route can't be found the returned list is empty.
startID | id of the start node |
targetID | id of the target node |
remember | whether to remember the examined edges. |
Implements pathfinder.IGraphSearch.
|
protected |
Used to remember examined edges
|
protected |
List for routes nodes in order of travel
|
protected |
Remember the route found to from
|
protected |
Stack of graph edges to consider
|
protected |
Used to remember which nodes had been visited