Class ShrinkingASLNeighbors<U>
java.lang.Object
es.uam.eps.ir.relison.sna.metrics.pair.AbstractPairMetric<U>
es.uam.eps.ir.relison.sna.metrics.distance.pair.ShrinkingASLNeighbors<U>
- Type Parameters:
U- type of the users.
- All Implemented Interfaces:
PairMetric<U>
public class ShrinkingASLNeighbors<U> extends AbstractPairMetric<U>
Computes the variation of the average shortest path length between the neighbors
of a pair of nodes if the link was added to the graph.
-
Field Summary
Fields Modifier and Type Field Description private DistanceCalculator<U>dcDistance calculator.private EdgeOrientationuSelNeighborhood selection for the origin user.private EdgeOrientationvSelNeighborhood selection for the destination user. -
Constructor Summary
Constructors Constructor Description ShrinkingASLNeighbors(EdgeOrientation uSel, EdgeOrientation vSel)Constructor.ShrinkingASLNeighbors(DistanceCalculator<U> dc, EdgeOrientation uSel, EdgeOrientation vSel)Constructor. -
Method Summary
Modifier and Type Method Description doubleaverageValue(Graph<U> graph)Computes the average value of the metricdoubleaverageValue(Graph<U> graph, java.util.stream.Stream<Pair<U>> pair, 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.doublecompute(Graph<U> graph, U orig, U dest)Computes the value of the metric for a single pair of nodesprivate doublecompute(U orig, U dest, java.util.Set<U> union, java.util.Map<U,java.util.Map<U,java.lang.Double>> distances)Methods inherited from class es.uam.eps.ir.relison.sna.metrics.pair.AbstractPairMetric
averageValueOnlyLinks, computeDest, computeOnlyLinks, computeOrig
-
Field Details
-
Constructor Details
-
ShrinkingASLNeighbors
Constructor.- Parameters:
uSel- neighborhood selection for the origin user.vSel- neighborhood selection for the destination user.
-
ShrinkingASLNeighbors
Constructor.- Parameters:
dc- distance calculator.uSel- neighborhood selection for the origin user.vSel- neighborhood selection for the destination user.
-
-
Method Details
-
compute
Description copied from interface:PairMetricComputes 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
-
compute
Description copied from interface:PairMetricComputes the value of the metric for all the possible pairs in the graph.- Specified by:
computein interfacePairMetric<U>- Overrides:
computein 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:PairMetricComputes the value of the metric for a selection of pairs in the graph.- Specified by:
computein interfacePairMetric<U>- Overrides:
computein 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:PairMetricComputes the average value of the metric- Specified by:
averageValuein interfacePairMetric<U>- Overrides:
averageValuein classAbstractPairMetric<U>- Parameters:
graph- The full graph.- Returns:
- The average value of the metric
-
averageValue
Description copied from interface:PairMetricComputes the average value of a certain group of pairs.- Specified by:
averageValuein interfacePairMetric<U>- Overrides:
averageValuein classAbstractPairMetric<U>- Parameters:
graph- the full graph.pair- a stream containing the selected pairs.pairCount- the number of pairs in the stream.- Returns:
- The average value of the metric for those pairs.
-