Class ShrinkingDiameter<U>

java.lang.Object
es.uam.eps.ir.relison.sna.metrics.pair.AbstractPairMetric<U>
es.uam.eps.ir.relison.sna.metrics.distance.pair.ShrinkingDiameter<U>
Type Parameters:
U - type of the users.
All Implemented Interfaces:
PairMetric<U>

public class ShrinkingDiameter<U>
extends AbstractPairMetric<U>
Computes the variation of the diameter if a link is included in the graph.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    private DistanceCalculator<U> dc
    Distance calculator.
  • Constructor Summary

    Constructors 
    Constructor Description
    ShrinkingDiameter()
    Constructor.
    ShrinkingDiameter​(DistanceCalculator<U> dc)
    Constructor.
  • Method Summary

    Modifier and Type Method Description
    double averageValue​(Graph<U> graph)
    Computes the average value of the metric
    double averageValue​(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.
    double compute​(Graph<U> graph, U orig, U dest)
    Computes the value of the metric for a single pair of nodes
    private double computePair​(Graph<U> graph, U u, U v, java.util.Set<U> uCIn, java.util.Set<U> uCOut, java.util.Set<U> vCIn, java.util.Set<U> vCOut, java.util.TreeMap<java.lang.Double,​java.util.List<Pair<U>>> pairsAtDistance, java.util.Map<U,​java.util.Map<U,​java.lang.Double>> distances)
    Computes the metric for an individual pair of users.

    Methods inherited from class es.uam.eps.ir.relison.sna.metrics.pair.AbstractPairMetric

    averageValueOnlyLinks, computeDest, computeOnlyLinks, computeOrig

    Methods inherited from class java.lang.Object

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

  • Constructor Details

  • 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.
    • compute

      public java.util.Map<Pair<U>,​java.lang.Double> compute​(Graph<U> graph)
      Description copied from interface: PairMetric
      Computes the value of the metric for all the possible pairs in the graph.
      Specified by:
      compute in interface PairMetric<U>
      Overrides:
      compute in class AbstractPairMetric<U>
      Parameters:
      graph - The full graph.
      Returns:
      A map containing the metrics for each node.
    • computePair

      private double computePair​(Graph<U> graph, U u, U v, java.util.Set<U> uCIn, java.util.Set<U> uCOut, java.util.Set<U> vCIn, java.util.Set<U> vCOut, java.util.TreeMap<java.lang.Double,​java.util.List<Pair<U>>> pairsAtDistance, java.util.Map<U,​java.util.Map<U,​java.lang.Double>> distances)
      Computes the metric for an individual pair of users.
      Parameters:
      graph - the graph.
      u - the origin user.
      v - the destination user.
      uCIn - the incoming component of user u.
      uCOut - the outgoing component of user u.
      vCIn - the incoming component of user v.
      vCOut - the outgoing component of user v.
      pairsAtDistance - map that contains the different pairs of users at a given distance.
      distances - the distances.
      Returns:
      the value of the metric.
    • 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 interface PairMetric<U>
      Overrides:
      compute in class AbstractPairMetric<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

      public double averageValue​(Graph<U> graph)
      Description copied from interface: PairMetric
      Computes the average value of the metric
      Specified by:
      averageValue in interface PairMetric<U>
      Overrides:
      averageValue in class AbstractPairMetric<U>
      Parameters:
      graph - The full graph.
      Returns:
      The average value of the metric
    • averageValue

      public double averageValue​(Graph<U> graph, java.util.stream.Stream<Pair<U>> pair, int pairCount)
      Description copied from interface: PairMetric
      Computes the average value of a certain group of pairs.
      Specified by:
      averageValue in interface PairMetric<U>
      Overrides:
      averageValue in class AbstractPairMetric<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.