public class GraphSearch_BFS extends java.lang.Object implements IGraphSearch
Constructor and Description |
---|
GraphSearch_BFS(Graph graph)
Create a search object that uses breadth first search algorithm
for the given graph.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears all data related to a search so this object can be
reused for another search
|
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_BFS(Graph graph)
graph
- the graph to usepublic void clear()
public 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