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 nodes
    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.
    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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • Weakness

      public Weakness​(EdgeOrientation uSel, EdgeOrientation vSel)
      Constructor.
      Parameters:
      uSel - selection of the neighbours of the first node.
      vSel - selection of the neighbours of the second node.
  • Method Details

    • compute

      public double compute​(Graph<U> graph, U orig, U dest)
      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

      public java.util.function.Function<U,​java.lang.Double> computeOrig​(Graph<U> graph, U orig)
      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 interface PairMetric<U>
      Overrides:
      computeOrig in class AbstractPairMetric<U>
      Parameters:
      graph - the graph.
      orig - the origin node.
      Returns:
      the map containing the values of the metric.
    • computeDest

      public java.util.function.Function<U,​java.lang.Double> computeDest​(Graph<U> graph, U dest)
      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 interface PairMetric<U>
      Overrides:
      computeDest in class AbstractPairMetric<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.