Class GeometricCentralities
public class GeometricCentralities extends Object
Note that usually one is interested in the negative version of a centrality measure, that is, the version that depends on the incoming arcs. This class can compute only positive centralities: if you are interested (as it usually happens) in the negative version, you must pass to this class the transpose of the graph.
Every visit is independent and is carried out by a separate thread. The only contention point is the update of the array accumulating the betweenness score, which is negligible. The downside is that running on k cores requires approximately k times the memory of the sequential algorithm, as only the graph and the betweenness array will be shared.
To use this class you first create an instance, and then invoke compute()
.
After that, you can peek at the fields closeness
, lin
, harmonic
, exponential
and reachable
.
-
Field Summary
Fields Modifier and Type Field Description double
alpha
double[]
closeness
Closeness centrality.static double
DEFAULT_ALPHA
The default value foralpha
.double[]
exponential
Exponential centrality.double[]
harmonic
Harmonic centrality.double[]
lin
Lin's centrality.protected AtomicInteger
nextNode
The next node to be visited.long[]
reachable
Number of reachable nodes.protected boolean
stop
Whether to stop abruptly the visiting process. -
Constructor Summary
Constructors Constructor Description GeometricCentralities(ImmutableGraph graph)
Creates a new class for computing positive geometric centralities and the number of reachable nodes, using as many threads as the number of available processors.GeometricCentralities(ImmutableGraph graph, int requestedThreads)
Creates a new class for computing positive geometric centralities and the number of reachable nodes.GeometricCentralities(ImmutableGraph graph, int requestedThreads, ProgressLogger pl)
Creates a new class for computing positive geometric centralities and the number reachable nodes.GeometricCentralities(ImmutableGraph graph, ProgressLogger pl)
Creates a new class for computing positive geometric centralities and the number of reachable nodes, using as many threads as the number of available processors. -
Method Summary
-
Field Details
-
DEFAULT_ALPHA
public static final double DEFAULT_ALPHAThe default value foralpha
.- See Also:
- Constant Field Values
-
harmonic
public final double[] harmonicHarmonic centrality. -
closeness
public final double[] closenessCloseness centrality. -
lin
public final double[] linLin's centrality. -
exponential
public final double[] exponentialExponential centrality. -
alpha
public double alpha -
reachable
public final long[] reachableNumber of reachable nodes. -
nextNode
The next node to be visited. -
stop
protected volatile boolean stopWhether to stop abruptly the visiting process.
-
-
Constructor Details
-
GeometricCentralities
Creates a new class for computing positive geometric centralities and the number reachable nodes.- Parameters:
graph
- a graph.requestedThreads
- the requested number of threads (0 forRuntime.availableProcessors()
).pl
- a progress logger, ornull
.
-
GeometricCentralities
Creates a new class for computing positive geometric centralities and the number of reachable nodes, using as many threads as the number of available processors.- Parameters:
graph
- a graph.pl
- a progress logger, ornull
.
-
GeometricCentralities
Creates a new class for computing positive geometric centralities and the number of reachable nodes.- Parameters:
graph
- a graph.requestedThreads
- the requested number of threads (0 forRuntime.availableProcessors()
).
-
GeometricCentralities
Creates a new class for computing positive geometric centralities and the number of reachable nodes, using as many threads as the number of available processors.- Parameters:
graph
- a graph.
-
-
Method Details
-
compute
Computes geometric centralities and the number of reachable nodes. Results can be found incloseness
,lin
,harmonic
,exponential
andreachable
.- Throws:
InterruptedException
-
main
-