netkit.util
Class ApproximateCentralities.ApproximateCentrality
java.lang.Object
netkit.util.ComputeProcess
netkit.util.ApproximateCentralities.ApproximateCentrality
- Enclosing class:
- ApproximateCentralities
public abstract class ApproximateCentralities.ApproximateCentrality
- extends ComputeProcess
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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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
ApproximateCentralities.ApproximateCentrality
protected ApproximateCentralities.ApproximateCentrality(java.lang.String name,
boolean weighted)
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()