Constructor and Description |
---|
BreadthFirstSearch(AbstractGraph<T> graph)
Prepares the search on the given graph
|
Modifier and Type | Method and Description |
---|---|
T |
getSourceVertex()
Returns the source vertex specified when search() was called.
|
java.util.LinkedList<BfsVertex> |
path(BfsVertex target)
Shows a shortest path from the source vertex passed in the search() method
to any given vertex in the graph.
|
void |
search(T source)
Executes the search on the input graph.
|
public BreadthFirstSearch(AbstractGraph<T> graph)
graph
- graph that will be searchedpublic void search(T source)
source
- source vertex from which shortest paths are to be determinedpublic T getSourceVertex()
public java.util.LinkedList<BfsVertex> path(BfsVertex target)
target
- the vertex to which the path is returnedjava.lang.IllegalStateException
- if search() has not yet been called