Class AbstractPairMetric<U>
java.lang.Object
es.uam.eps.ir.relison.sna.metrics.pair.AbstractPairMetric<U>
- Type Parameters:
U
- type of the users.
- All Implemented Interfaces:
PairMetric<U>
- Direct Known Subclasses:
ClusteringCoefficientIncrement
,ComplementaryEmbededness
,ComplementaryNeighbourOverlap
,Distance
,DistanceWithoutLink
,EdgeWeight
,Embededness
,Geodesics
,ReciprocalShortestPathLength
,ShrinkingASL
,ShrinkingASLNeighbors
,ShrinkingDiameter
,ShrinkingDiameterNeighbors
,Weakness
,WeightedNeighborOverlap
public abstract class AbstractPairMetric<U> extends java.lang.Object implements PairMetric<U>
Abstract implementation of a pair metric.
-
Constructor Summary
Constructors Constructor Description AbstractPairMetric()
-
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.double
averageValueOnlyLinks(Graph<U> graph)
Computes the average value of the metric, restricted to the set of links in the network.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.java.util.function.Function<U,java.lang.Double>
computeDest(Graph<U> graph, U dest)
Given a user, computes the value of a metric for all the possible pairs in the graph where the user is the destination.java.util.Map<Pair<U>,java.lang.Double>
computeOnlyLinks(Graph<U> graph)
Computes the value of the metric for all the links in the graph.java.util.function.Function<U,java.lang.Double>
computeOrig(Graph<U> graph, U orig)
Given a user, computes the value of a metric for all the possible pairs in the graph where the user is the origin.
-
Constructor Details
-
AbstractPairMetric
public AbstractPairMetric()
-
-
Method Details
-
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>
- Parameters:
graph
- The full graph.- Returns:
- A map containing the metrics for each node.
-
computeOnlyLinks
Description copied from interface:PairMetric
Computes the value of the metric for all the links in the graph.- Specified by:
computeOnlyLinks
in interfacePairMetric<U>
- Parameters:
graph
- the full graph.- Returns:
- A map containing the metrics for each link.
-
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>
- 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>
- 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>
- 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.
-
averageValueOnlyLinks
Description copied from interface:PairMetric
Computes the average value of the metric, restricted to the set of links in the network.- Specified by:
averageValueOnlyLinks
in interfacePairMetric<U>
- Parameters:
graph
- the network.- Returns:
- the average value of the metric over the links in the network.
-
computeOrig
Description copied from interface:PairMetric
Given a user, computes the value of a metric for all the possible pairs in the graph where the user is the origin. As, for efficiency methods, all values might not be computed, the default value of the metric shall be retrieved from the outcome.- Specified by:
computeOrig
in interfacePairMetric<U>
- Parameters:
graph
- the graph.orig
- the origin node.- Returns:
- the map containing the values of the metric.
-
computeDest
Description copied from interface:PairMetric
Given a user, computes the value of a metric for all the possible pairs in the graph where the user is the destination. As, for efficiency methods, all values might not be computed, the default value of the metric shall be retrieved from the outcome.- Specified by:
computeDest
in interfacePairMetric<U>
- Parameters:
graph
- the graph.dest
- the origin node.- Returns:
- the map containing the values of the metric.
-