org.javanetworkanalyzer.alg
Class BFSForCentrality<E extends EdgeSPT>

java.lang.Object
  extended by org.javanetworkanalyzer.alg.GraphSearchAlgorithm<V,E>
      extended by org.javanetworkanalyzer.alg.BFS<VUCent,E>
          extended by org.javanetworkanalyzer.alg.BFSForCentrality<E>
All Implemented Interfaces:
CentralityAlg<VUCent,E,UnweightedPathLengthData>, TraversalAlg<VUCent,E>

public class BFSForCentrality<E extends EdgeSPT>
extends BFS<VUCent,E>
implements CentralityAlg<VUCent,E,UnweightedPathLengthData>

Uses BFS to do graph analysis (calculating betweenness centrality, etc.).

Author:
Adam Gouge

Field Summary
 
Fields inherited from class org.javanetworkanalyzer.alg.GraphSearchAlgorithm
currentStartNode, graph
 
Constructor Summary
BFSForCentrality(org.jgrapht.Graph<VUCent,E> graph, Stack<VUCent> stack)
          Constructs a new BFSForCentrality object.
 
Method Summary
protected  VUCent dequeueStep(LinkedList<VUCent> queue)
          Dequeues a node from the given queue and pushes it to the stack.
protected  void firstTimeFoundStep(VUCent current, VUCent neighbor)
          Work to be done after BFS.enqueueAndUpdateDistance(V, V, java.util.LinkedList).
 UnweightedPathLengthData getPaths()
          Returns the path length data.
protected  void init(VUCent startNode)
          Performs any initializations to be done at the start of the TraversalAlg.calculate(V) method.
protected  void shortestPathStep(VUCent current, VUCent 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.BFS
calculate, enqueueAndUpdateDistance
 
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
 
Methods inherited from interface org.javanetworkanalyzer.alg.TraversalAlg
calculate, reconstructTraversalGraph
 

Constructor Detail

BFSForCentrality

public BFSForCentrality(org.jgrapht.Graph<VUCent,E> graph,
                        Stack<VUCent> stack)
Constructs a new BFSForCentrality object.

Parameters:
graph - The graph.
stack - Stack which returns nodes in order of non-increasing distance from the start node
Method Detail

init

protected void init(VUCent startNode)
Description copied from class: GraphSearchAlgorithm
Performs any initializations to be done at the start of the TraversalAlg.calculate(V) method.

Overrides:
init in class BFS<VUCent,E extends EdgeSPT>
Parameters:
startNode - Start node

dequeueStep

protected VUCent dequeueStep(LinkedList<VUCent> queue)
Dequeues a node from the given queue and pushes it to the stack.

Overrides:
dequeueStep in class BFS<VUCent,E extends EdgeSPT>
Parameters:
queue - The queue.
Returns:
The newly dequeued node.

firstTimeFoundStep

protected void firstTimeFoundStep(VUCent current,
                                  VUCent neighbor)
Description copied from class: BFS
Work to be done after BFS.enqueueAndUpdateDistance(V, V, java.util.LinkedList).

Overrides:
firstTimeFoundStep in class BFS<VUCent,E extends EdgeSPT>
Parameters:
current - Current node
neighbor - Neighbor node

shortestPathStep

protected void shortestPathStep(VUCent current,
                                VUCent neighbor,
                                E e)
Description copied from class: BFS
Work to be done if this is a shortest path from the start node to neighbor via current.

Overrides:
shortestPathStep in class BFS<VUCent,E extends EdgeSPT>
Parameters:
current - Current node
neighbor - Neighbor node
e - Edge (current, neighbor)

getPaths

public UnweightedPathLengthData getPaths()
Description copied from interface: CentralityAlg
Returns the path length data.

Specified by:
getPaths in interface CentralityAlg<VUCent,E extends EdgeSPT,UnweightedPathLengthData>
Returns:
The path length data


Copyright © 2014. All Rights Reserved.