netkit.util
Class ApproximateCentralities.ApproximateCentrality

java.lang.Object
  extended by netkit.util.ComputeProcess
      extended by netkit.util.ApproximateCentralities.ApproximateCentrality
Enclosing class:
ApproximateCentralities

public abstract class ApproximateCentralities.ApproximateCentrality
extends ComputeProcess


Field Summary
protected  boolean[] active
           
protected  double alpha
           
protected  double[] centrality
           
protected  double delta
           
protected  double epsilon
           
protected  double[] residual
           
protected  boolean weighted
           
 
Fields inherited from class netkit.util.ComputeProcess
logger, progress
 
Constructor Summary
protected ApproximateCentralities.ApproximateCentrality(java.lang.String name, boolean weighted)
           
 
Method Summary
protected  void cleanup()
           
 double getCentrality(int node)
          Get the centrality for the given node.
 double getCentrality(Node n)
          Get the centrality for the given node.
protected abstract  boolean init()
           
protected abstract  java.util.Queue<java.lang.Integer> initQueue()
           
protected  boolean run()
          This method is the main computation method.
protected  boolean setDegree()
           
protected  boolean setInDegree()
           
protected  boolean setNodes()
           
protected abstract  int updateQueue(int node, java.util.Queue<java.lang.Integer> queue)
          Update the queue with the current node, returning the first node index which was added (if any)
protected abstract  void validateSettings()
          Validates settings such as alpha, delta, etc.
 
Methods inherited from class netkit.util.ComputeProcess
active, name, progress, start, stop, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

centrality

protected double[] centrality

residual

protected double[] residual

active

protected boolean[] active

weighted

protected final boolean weighted

epsilon

protected double epsilon

alpha

protected double alpha

delta

protected double delta
Constructor Detail

ApproximateCentralities.ApproximateCentrality

protected ApproximateCentralities.ApproximateCentrality(java.lang.String name,
                                                        boolean weighted)
Method Detail

updateQueue

protected abstract int updateQueue(int node,
                                   java.util.Queue<java.lang.Integer> queue)
Update the queue with the current node, returning the first node index which was added (if any)

Parameters:
node -
queue -
Returns:
index of first node added or -1 if no node added

initQueue

protected abstract java.util.Queue<java.lang.Integer> initQueue()

init

protected abstract boolean init()

validateSettings

protected abstract void validateSettings()
Validates settings such as alpha, delta, etc. and reset the centrality array + progress if new GraphMetric settings are different


getCentrality

public double getCentrality(Node n)
Get the centrality for the given node.

Returns:
the centrality for the given node.

getCentrality

public double getCentrality(int node)
Get the centrality for the given node.

Returns:
the centrality for the given node.

setNodes

protected boolean setNodes()

setInDegree

protected boolean setInDegree()

setDegree

protected boolean setDegree()

run

protected boolean run()
Description copied from class: ComputeProcess
This method is the main computation method. It should check the active boolean regularly to see if it should abort the process.

Specified by:
run in class ComputeProcess
Returns:
false if it aborted, true otherwise

cleanup

protected void cleanup()