Class Closeness<U>
java.lang.Object
es.uam.eps.ir.relison.sna.metrics.distance.vertex.Closeness<U>
- Type Parameters:
U
- Type of the users.
- All Implemented Interfaces:
VertexMetric<U>
- Direct Known Subclasses:
HarmonicCentrality
public class Closeness<U> extends java.lang.Object implements VertexMetric<U>
Metric that computes the closeness of the nodes.
References:
M.E.J. Newman. Networks: an introduction (2010)
L.C. Freeman. Centrality in Networks: I. Conceptual clarification, Social Networks 1, 1979, pp.215-239
-
Field Summary
Fields Modifier and Type Field Description private DistanceCalculator<U>
dc
Distance calculator.private ClosenessMode
mode
Calculation mode. -
Constructor Summary
Constructors Modifier Constructor Description Closeness()
Basic constructor.Closeness(DistanceCalculator<U> dc)
Constructor.protected
Closeness(DistanceCalculator<U> dc, ClosenessMode mode)
Constructor.protected
Closeness(ClosenessMode mode)
Constructor. -
Method Summary
Modifier and Type Method Description double
averageValue(Graph<U> graph)
Computes the average value of the metric in the graph.java.util.Map<U,java.lang.Double>
compute(Graph<U> graph)
Computes the value of the metric for all the users in the graph.double
compute(Graph<U> graph, U user)
Computes the value of the metric for a single user.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface es.uam.eps.ir.relison.sna.metrics.VertexMetric
averageValue, compute
-
Field Details
-
Constructor Details
-
Closeness
public Closeness()Basic constructor. Uses the harmonic mean computing algorithm. -
Closeness
Constructor.- Parameters:
mode
- Computing algorithm to use.
-
Closeness
Constructor. Uses the harmonic mean computing algorithm.- Parameters:
dc
- distance calculator.
-
Closeness
Constructor.- Parameters:
dc
- distance calculator.mode
- computing algorithm.
-
-
Method Details
-
compute
Description copied from interface:VertexMetric
Computes the value of the metric for a single user.- Specified by:
compute
in interfaceVertexMetric<U>
- Parameters:
graph
- The graph.user
- The user to compute.- Returns:
- the value of the metric.
-
compute
Description copied from interface:VertexMetric
Computes the value of the metric for all the users in the graph.- Specified by:
compute
in interfaceVertexMetric<U>
- Parameters:
graph
- The graph.- Returns:
- A map relating the users with the values of the metric.
-
averageValue
Description copied from interface:VertexMetric
Computes the average value of the metric in the graph.- Specified by:
averageValue
in interfaceVertexMetric<U>
- Parameters:
graph
- The graph.- Returns:
- the average value of the metric.
-