|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.javanetworkanalyzer.alg.GraphSearchAlgorithm<V,E>
org.javanetworkanalyzer.alg.BFS<V,E>
V - The data structure to hold node information during the execution
of BFS.public class BFS<V extends VBFS,E extends EdgeSPT>
Root Breadth First Search (BFS) class.
Thecalculate(V) method can be overridden in subclasses in order to
do graph analysis (e.g., calculating betweenness centrality).
| Field Summary |
|---|
| Fields inherited from class org.javanetworkanalyzer.alg.GraphSearchAlgorithm |
|---|
currentStartNode, graph |
| Constructor Summary | |
|---|---|
BFS(org.jgrapht.Graph<V,E> graph)
Constructor. |
|
| Method Summary | |
|---|---|
void |
calculate(V startNode)
Does a breadth first search from the given start node to all other nodes. |
protected V |
dequeueStep(LinkedList<V> queue)
Dequeues a node from the given queue. |
protected void |
enqueueAndUpdateDistance(V current,
V neighbor,
LinkedList<V> queue)
Enqueue neighbor and set neighbor's distance to be one more than current's distance. |
protected void |
firstTimeFoundStep(V current,
V neighbor)
Work to be done after enqueueAndUpdateDistance(V, V, java.util.LinkedList. |
protected void |
init(V startNode)
Performs any initializations to be done at the start of the TraversalAlg.calculate(V) method. |
protected void |
shortestPathStep(V current,
V neighbor,
E e)
Work to be done if this is a shortest path from the start node to neighbor via current. |
| Methods inherited from class org.javanetworkanalyzer.alg.GraphSearchAlgorithm |
|---|
outdegree, outgoingEdgesOf, outgoingEdgesOf, reconstructTraversalGraph, successorListOf |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public BFS(org.jgrapht.Graph<V,E> graph)
graph - The graph.| Method Detail |
|---|
public void calculate(V startNode)
startNode - Start nodeprotected void init(V startNode)
GraphSearchAlgorithmTraversalAlg.calculate(V) method.
init in class GraphSearchAlgorithm<V extends VBFS,E extends EdgeSPT>startNode - Start nodeprotected V dequeueStep(LinkedList<V> queue)
queue - The queue.
protected void enqueueAndUpdateDistance(V current,
V neighbor,
LinkedList<V> queue)
current - Current nodeneighbor - Neighbor nodequeue - The queue
protected void firstTimeFoundStep(V current,
V neighbor)
enqueueAndUpdateDistance(V, V, java.util.LinkedList) .
current - Current nodeneighbor - Neighbor node
protected void shortestPathStep(V current,
V neighbor,
E e)
current - Current nodeneighbor - Neighbor nodee - Edge (current, neighbor)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||