V - vertex typepublic class BFS<V> extends TraversalFromRoots<V> implements GraphTraversal<V>
| Modifier and Type | Class and Description |
|---|---|
static class |
BFS.Node<V>
This is a node in a BFS-spanning tree.
|
g| Constructor and Description |
|---|
BFS(Graph<V,? extends Edge<V>> g)
Constructs a BFS tree of a graph.
|
| Modifier and Type | Method and Description |
|---|---|
static <V,W extends V> |
BFS(Graph<W,? extends Edge<V>> g,
V root,
int time)
Runs the breadth-first-search on a graph from a designated root.
|
List<BFS.Node<V>> |
getOrderedNodes()
Gets the collection of visited nodes to build a spanning tree.
|
List<? extends BFS.Node<V>> |
track(V root,
int time)
Runs the traversal algorithm on a graph from a designated root.
|
traversepublic List<? extends BFS.Node<V>> track(V root, int time)
TraversalFromRootstrack in class TraversalFromRoots<V>root - a roottime - the initial timepublic static <V,W extends V> List<BFS.Node<V>> BFS(Graph<W,? extends Edge<V>> g, V root, int time)
V - vertex typeg - a graphroot - a roottime - the initial timepublic List<BFS.Node<V>> getOrderedNodes()
TraversalFromRootsgetOrderedNodes in interface GraphTraversal<V>getOrderedNodes in class TraversalFromRoots<V>Copyright © 2010-2020 NM FinTech Ltd.. All Rights Reserved.