Class PearsonCorrelation<U>

java.lang.Object
es.uam.eps.ir.relison.sna.metrics.graph.PearsonCorrelation<U>
Type Parameters:
U - Type of the users.
All Implemented Interfaces:
GraphMetric<U>
Direct Known Subclasses:
DegreePearsonCorrelation

public class PearsonCorrelation<U>
extends java.lang.Object
implements GraphMetric<U>
Class for computing the Pearson correlation of scalar values for a graph.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    private java.util.function.ToDoubleBiFunction<U,​Graph<U>> destinyFunction
    Function for computing the values for each destiny node in the link.
    private java.util.function.ToDoubleBiFunction<U,​Graph<U>> originFunction
    Function for computing the values for each origin node in the link.
  • Constructor Summary

    Constructors 
    Constructor Description
    PearsonCorrelation​(java.util.function.ToDoubleBiFunction<U,​Graph<U>> originFunction, java.util.function.ToDoubleBiFunction<U,​Graph<U>> destinyFunction)
    Constructor
  • Method Summary

    Modifier and Type Method Description
    double compute​(Graph<U> graph)
    Computes the value.
    private double computeDirected​(DirectedGraph<U> graph, java.util.Map<U,​java.lang.Double> originRes, java.util.Map<U,​java.lang.Double> destinyRes)
    Computes the assortativity for directed graphs.
    private double computeUndirected​(UndirectedGraph<U> graph, java.util.Map<U,​java.lang.Double> originRes, java.util.Map<U,​java.lang.Double> destinyRes)
    Computes the assortativity for directed graphs.

    Methods inherited from class java.lang.Object

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

    • originFunction

      private final java.util.function.ToDoubleBiFunction<U,​Graph<U>> originFunction
      Function for computing the values for each origin node in the link.
    • destinyFunction

      private final java.util.function.ToDoubleBiFunction<U,​Graph<U>> destinyFunction
      Function for computing the values for each destiny node in the link.
  • Constructor Details

    • PearsonCorrelation

      public PearsonCorrelation​(java.util.function.ToDoubleBiFunction<U,​Graph<U>> originFunction, java.util.function.ToDoubleBiFunction<U,​Graph<U>> destinyFunction)
      Constructor
      Parameters:
      originFunction - Function for computing the values for each origin node in the link.
      destinyFunction - Function for computing the values for each destiny node in the link.
  • Method Details

    • compute

      public double compute​(Graph<U> graph)
      Description copied from interface: GraphMetric
      Computes the value.
      Specified by:
      compute in interface GraphMetric<U>
      Parameters:
      graph - graph metric.
      Returns:
      the value of the metric.
    • computeDirected

      private double computeDirected​(DirectedGraph<U> graph, java.util.Map<U,​java.lang.Double> originRes, java.util.Map<U,​java.lang.Double> destinyRes)
      Computes the assortativity for directed graphs.
      Parameters:
      graph - the graph.
      originRes - the values for the origin node.
      destinyRes - the values for the destination node.
      Returns:
      the Pearson correlation of the directed graph.
    • computeUndirected

      private double computeUndirected​(UndirectedGraph<U> graph, java.util.Map<U,​java.lang.Double> originRes, java.util.Map<U,​java.lang.Double> destinyRes)
      Computes the assortativity for directed graphs.
      Parameters:
      graph - the graph.
      originRes - the values for the origin node.
      destinyRes - the values for the destination node.
      Returns:
      the Pearson correlation of the undirected graph.