public class GraphSearch_Dijkstra extends java.lang.Object implements IGraphSearch
Constructor and Description |
---|
GraphSearch_Dijkstra(Graph graph)
Create a search object that uses Dijkstra's algorithm
for the given graph.
|
Modifier and Type | Method and Description |
---|---|
GraphEdge[] |
getExaminedEdges()
Get all the edges examined during the search.
|
<T> T[] |
getExaminedEdges(T[] array)
Get all the edges examined during the search.
|
GraphNode[] |
getRoute()
Get the path found as an array of GraphNode(s) in start->end
order
|
<T> T[] |
getRoute(T[] array)
Get the path found as an array of T(s) in start->end
order.
|
java.util.LinkedList<GraphNode> |
search(int startID,
int targetID)
Search for a route from node startID and ends at targetID.
|
java.util.LinkedList<GraphNode> |
search(int startID,
int targetID,
boolean remember)
Search for a route from node startID and ends at targetID.
|
public GraphSearch_Dijkstra(Graph graph)
graph
- the graph to usepublic java.util.LinkedList<GraphNode> search(int startID, int targetID)
search
in interface IGraphSearch
startID
- id of the start nodetargetID
- id of the target nodepublic java.util.LinkedList<GraphNode> search(int startID, int targetID, boolean remember)
search
in interface IGraphSearch
startID
- id of the start nodetargetID
- id of the target noderemember
- whether to remember the examined edges.public GraphEdge[] getExaminedEdges()
getExaminedEdges
in interface IGraphSearch
public <T> T[] getExaminedEdges(T[] array)
getExaminedEdges
in interface IGraphSearch
array
- the array to populatepublic GraphNode[] getRoute()
getRoute
in interface IGraphSearch
public <T> T[] getRoute(T[] array)
getRoute
in interface IGraphSearch
array
- the array to populateProcessing library AI_for_2D_Games by Peter Lager. (C) 2013