Class Weakness<U>
java.lang.Object
es.uam.eps.ir.relison.sna.metrics.pair.AbstractPairMetric<U>
es.uam.eps.ir.relison.sna.metrics.pair.Weakness<U>
- Type Parameters:
U
- type of the users in the graph.
- All Implemented Interfaces:
PairMetric<U>
public class Weakness<U> extends AbstractPairMetric<U>
Computes the weakness of the pairs of nodes of a graph.
Reference: D. Easley, J.M. Kleinberg. Networks, crowds and markets (2010)
-
Field Summary
Fields Modifier and Type Field Description private EdgeOrientation
uSel
Selection of the neighbours of the first node.private EdgeOrientation
vSel
Selection of the neighbour of the second node. -
Constructor Summary
Constructors Constructor Description Weakness(EdgeOrientation uSel, EdgeOrientation vSel)
Constructor. -
Method Summary
Modifier and Type Method Description double
compute(Graph<U> graph, U orig, U dest)
Computes the value of the metric for a single pair of nodesjava.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.private java.util.function.Function<U,java.lang.Double>
computeIndividual(Graph<U> graph, U u, EdgeOrientation uSel, EdgeOrientation vSel)
Computes the map of metrics for the user.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.Methods inherited from class es.uam.eps.ir.relison.sna.metrics.pair.AbstractPairMetric
averageValue, averageValue, averageValueOnlyLinks, compute, compute, computeOnlyLinks
-
Field Details
-
Constructor Details
-
Weakness
Constructor.- Parameters:
uSel
- selection of the neighbours of the first node.vSel
- selection of the neighbours of the second node.
-
-
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.
-
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>
- Overrides:
computeOrig
in classAbstractPairMetric<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>
- Overrides:
computeDest
in classAbstractPairMetric<U>
- Parameters:
graph
- the graph.dest
- the origin node.- Returns:
- the map containing the values of the metric.
-
computeIndividual
private java.util.function.Function<U,java.lang.Double> computeIndividual(Graph<U> graph, U u, EdgeOrientation uSel, EdgeOrientation vSel)Computes the map of metrics for the user.- Parameters:
graph
- the graph.u
- the user.uSel
- the neighborhood selection for the user.vSel
- the neighborhood selection for the other users.- Returns:
- the map of metrics for the user.
-