public class DistanceCentralityScorer<V,E> extends java.lang.Object implements VertexScorer<V,java.lang.Double>
true,
then the value returned for vertex v is 1 / (_average_ distance from v to all other vertices);
this is sometimes called closeness centrality.
If it is false, then the value returned is 1 / (_total_ distance from
v to all other vertices); this is sometimes referred to as barycenter centrality.
(If the average/total distance is 0, the value returned is Double.POSITIVE_INFINITY.| Modifier and Type | Field and Description |
|---|---|
protected boolean |
averaging
Specifies whether the values returned are the sum of the v-distances
or the mean v-distance.
|
protected Distance<V> |
distance
The metric to use for specifying the distance between pairs of vertices.
|
protected Hypergraph<V,E> |
graph
The graph on which the vertex scores are to be calculated.
|
protected boolean |
ignore_missing
Specifies whether, for a vertex
v with missing (null) distances,
v's score should ignore the missing values or be set to 'null'. |
protected boolean |
ignore_self_distances
Specifies whether the values returned should ignore self-distances
(distances from
v to itself). |
protected java.util.Map<V,java.lang.Double> |
output
The cache for the output results.
|
| Constructor and Description |
|---|
DistanceCentralityScorer(Hypergraph<V,E> graph,
boolean averaging)
Equivalent to
this(graph, averaging, true, true). |
DistanceCentralityScorer(Hypergraph<V,E> graph,
boolean averaging,
boolean ignore_missing,
boolean ignore_self_distances)
Creates an instance with the specified graph and averaging behavior
whose vertex distances are calculated on the unweighted graph.
|
DistanceCentralityScorer(Hypergraph<V,E> graph,
Distance<V> distance,
boolean averaging)
Equivalent to
this(graph, distance, averaging, true, true). |
DistanceCentralityScorer(Hypergraph<V,E> graph,
Distance<V> distance,
boolean averaging,
boolean ignore_missing,
boolean ignore_self_distances)
Creates an instance with the specified graph, distance metric, and
averaging behavior.
|
DistanceCentralityScorer(Hypergraph<V,E> graph,
org.apache.commons.collections15.Transformer<E,? extends java.lang.Number> edge_weights,
boolean averaging)
Equivalent to
this(graph, edge_weights, averaging, true, true). |
DistanceCentralityScorer(Hypergraph<V,E> graph,
org.apache.commons.collections15.Transformer<E,? extends java.lang.Number> edge_weights,
boolean averaging,
boolean ignore_missing,
boolean ignore_self_distances)
Creates an instance with the specified graph and averaging behavior
whose vertex distances are calculated based on the specified edge
weights.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.Double |
getVertexScore(V v)
Calculates the score for the specified vertex.
|
protected Hypergraph<V,E> graph
protected Distance<V> distance
protected java.util.Map<V,java.lang.Double> output
protected boolean averaging
protected boolean ignore_missing
v with missing (null) distances,
v's score should ignore the missing values or be set to 'null'.
Defaults to 'true'.protected boolean ignore_self_distances
v to itself).
Defaults to 'true'.public DistanceCentralityScorer(Hypergraph<V,E> graph, Distance<V> distance, boolean averaging, boolean ignore_missing, boolean ignore_self_distances)
graph - The graph on which the vertex scores are to be calculated.distance - The metric to use for specifying the distance between
pairs of vertices.averaging - Specifies whether the values returned is the sum of all
v-distances or the mean v-distance.ignore_missing - Specifies whether scores for missing distances
are to ignore missing distances or be set to null.ignore_self_distances - Specifies whether distances from a vertex
to itself should be included in its score.public DistanceCentralityScorer(Hypergraph<V,E> graph, Distance<V> distance, boolean averaging)
this(graph, distance, averaging, true, true).graph - The graph on which the vertex scores are to be calculated.distance - The metric to use for specifying the distance between
pairs of vertices.averaging - Specifies whether the values returned is the sum of all
v-distances or the mean v-distance.public DistanceCentralityScorer(Hypergraph<V,E> graph, org.apache.commons.collections15.Transformer<E,? extends java.lang.Number> edge_weights, boolean averaging, boolean ignore_missing, boolean ignore_self_distances)
graph - The graph on which the vertex scores are to be
calculated.edge_weights - The edge weights to use for specifying the distance
between pairs of vertices.averaging - Specifies whether the values returned is the sum of
all v-distances or the mean v-distance.ignore_missing - Specifies whether scores for missing distances
are to ignore missing distances or be set to null.ignore_self_distances - Specifies whether distances from a vertex
to itself should be included in its score.public DistanceCentralityScorer(Hypergraph<V,E> graph, org.apache.commons.collections15.Transformer<E,? extends java.lang.Number> edge_weights, boolean averaging)
this(graph, edge_weights, averaging, true, true).graph - The graph on which the vertex scores are to be
calculated.edge_weights - The edge weights to use for specifying the distance
between pairs of vertices.averaging - Specifies whether the values returned is the sum of
all v-distances or the mean v-distance.public DistanceCentralityScorer(Hypergraph<V,E> graph, boolean averaging, boolean ignore_missing, boolean ignore_self_distances)
graph - The graph on which the vertex scores are to be
calculated.averaging - Specifies whether the values returned is the sum of
all v-distances or the mean v-distance.ignore_missing - Specifies whether scores for missing distances
are to ignore missing distances or be set to null.ignore_self_distances - Specifies whether distances from a vertex
to itself should be included in its score.public DistanceCentralityScorer(Hypergraph<V,E> graph, boolean averaging)
this(graph, averaging, true, true).graph - The graph on which the vertex scores are to be
calculated.averaging - Specifies whether the values returned is the sum of
all v-distances or the mean v-distance.public java.lang.Double getVertexScore(V v)
null if
there are missing distances and such are not ignored by this instance.getVertexScore in interface VertexScorer<V,java.lang.Double>Copyright © 2021, 2022 Herve Girod. All Rights Reserved. Documentation and source under the BSD 3-Clause licence