Class WeightedNeighborOverlap<U>
java.lang.Object
es.uam.eps.ir.relison.sna.metrics.pair.AbstractPairMetric<U>
es.uam.eps.ir.relison.sna.metrics.pair.WeightedNeighborOverlap<U>
- Type Parameters:
U
- type of the nodes.
- All Implemented Interfaces:
PairMetric<U>
public class WeightedNeighborOverlap<U> extends AbstractPairMetric<U>
Computes the intersection between the neighborhoods of two nodes.
-
Field Summary
Fields Modifier and Type Field Description private EdgeOrientation
uSel
Neighbour selection for the origin node.private EdgeOrientation
vSel
Neighbour selection for the destiny node. -
Constructor Summary
Constructors Constructor Description WeightedNeighborOverlap()
Default constructor.WeightedNeighborOverlap(EdgeOrientation uSel, EdgeOrientation vSel)
Constructor. -
Method Summary
Modifier and Type Method Description 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 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, computeOnlyLinks
-
Field Details
-
Constructor Details
-
WeightedNeighborOverlap
public WeightedNeighborOverlap()Default constructor. Uses the outgoing neighbourhood of the origin node, and the incoming of the destiny one. -
WeightedNeighborOverlap
Constructor.- Parameters:
uSel
- Neighbour selection for the origin node.vSel
- Neighbour selection for the destiny 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.
-
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.
-
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.
-