Class ReciprocalShortestPathLength<U>
java.lang.Object
es.uam.eps.ir.relison.sna.metrics.pair.AbstractPairMetric<U>
es.uam.eps.ir.relison.sna.metrics.distance.pair.ReciprocalShortestPathLength<U>
- Type Parameters:
U
- Type of the users.
- All Implemented Interfaces:
PairMetric<U>
public class ReciprocalShortestPathLength<U> extends AbstractPairMetric<U>
Computes the Reciprocal Shortest Path Length.
References:
- J. Sanz-Cruzado, P. Castells. Beyond accuracy in link prediction. 3rd Workshop on Social Media for Personalization and Search (SoMePEaS 2019).
- J. Sanz-Cruzado, S.M. Pepa, P. Castells. Structural novelty and diversity in link prediction. 9th International Workshop on Modeling Social Media (MSM 2018) at The Web Conference (WWW 2018)
-
Field Summary
Fields Modifier and Type Field Description private DistanceCalculator<U>
dc
Distance calculator. -
Constructor Summary
Constructors Constructor Description ReciprocalShortestPathLength()
Constructor.ReciprocalShortestPathLength(DistanceCalculator<U> dc)
Constructor. -
Method Summary
Modifier and Type Method Description double
averageValue(Graph<U> graph)
Computes the average value of the metricdouble
averageValue(Graph<U> graph, java.util.stream.Stream<Pair<U>> pairs, int pairCount)
Computes the average value of a certain group of pairs.java.util.Map<Pair<U>,java.lang.Double>
compute(Graph<U> graph)
Computes the value of the metric for all the possible pairs in the graph.java.util.Map<Pair<U>,java.lang.Double>
compute(Graph<U> graph, java.util.stream.Stream<Pair<U>> pairs)
Computes the value of the metric for a selection of pairs in the graph.double
compute(Graph<U> graph, U orig, U dest)
Computes the value of the metric for a single pair of nodesMethods inherited from class es.uam.eps.ir.relison.sna.metrics.pair.AbstractPairMetric
averageValueOnlyLinks, computeDest, computeOnlyLinks, computeOrig
-
Field Details
-
dc
Distance calculator.
-
-
Constructor Details
-
ReciprocalShortestPathLength
public ReciprocalShortestPathLength()Constructor. -
ReciprocalShortestPathLength
Constructor.- Parameters:
dc
- distance calculator.
-
-
Method Details
-
compute
Description copied from interface:PairMetric
Computes the value of the metric for a single pair of nodes- Parameters:
graph
- The full graph.orig
- The origin node of the edge.dest
- The destiny node of the edge.- Returns:
- The value of the metric for that edge.
-
compute
Description copied from interface:PairMetric
Computes the value of the metric for all the possible pairs in the graph.- Specified by:
compute
in interfacePairMetric<U>
- Overrides:
compute
in classAbstractPairMetric<U>
- Parameters:
graph
- The full graph.- Returns:
- A map containing the metrics for each node.
-
compute
public java.util.Map<Pair<U>,java.lang.Double> compute(Graph<U> graph, java.util.stream.Stream<Pair<U>> pairs)Description copied from interface:PairMetric
Computes the value of the metric for a selection of pairs in the graph.- Specified by:
compute
in interfacePairMetric<U>
- Overrides:
compute
in classAbstractPairMetric<U>
- Parameters:
graph
- The full graph.pairs
- A stream containing the selected pairs.- Returns:
- A map containing the metrics for each pair in the stream that exists.
-
averageValue
Description copied from interface:PairMetric
Computes the average value of the metric- Specified by:
averageValue
in interfacePairMetric<U>
- Overrides:
averageValue
in classAbstractPairMetric<U>
- Parameters:
graph
- The full graph.- Returns:
- The average value of the metric
-
averageValue
Description copied from interface:PairMetric
Computes the average value of a certain group of pairs.- Specified by:
averageValue
in interfacePairMetric<U>
- Overrides:
averageValue
in classAbstractPairMetric<U>
- Parameters:
graph
- the full graph.pairs
- a stream containing the selected pairs.pairCount
- the number of pairs in the stream.- Returns:
- The average value of the metric for those pairs.
-