Class Degree<U>

java.lang.Object
es.uam.eps.ir.relison.sna.metrics.vertex.Degree<U>
Type Parameters:
U - type of the users.
All Implemented Interfaces:
VertexMetric<U>

public class Degree<U>
extends java.lang.Object
implements VertexMetric<U>
Computes the degree of a given user in a graph.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    private EdgeOrientation orientation
    The orientation in which the score is computed.
  • Constructor Summary

    Constructors 
    Constructor Description
    Degree​(EdgeOrientation orientation)
    Constructor.
  • Method Summary

    Modifier and Type Method Description
    double averageValue​(Graph<U> graph)
    Computes the average value of the metric in the graph.
    double compute​(Graph<U> graph, U user)
    Computes the value of the metric for a single user.
    private double computeDirected​(DirectedGraph<U> directedGraph, U user)
    Computes the degree of the user in a directed graph.
    private double computeUndirected​(UndirectedGraph<U> undirectedGraph, U user)
    Computes the degree of the user in an undirected graph.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface es.uam.eps.ir.relison.sna.metrics.VertexMetric

    averageValue, compute, compute
  • Field Details

  • Constructor Details

    • Degree

      public Degree​(EdgeOrientation orientation)
      Constructor.
      Parameters:
      orientation - The orientation in which to take the value.
  • Method Details

    • compute

      public double compute​(Graph<U> graph, U user)
      Description copied from interface: VertexMetric
      Computes the value of the metric for a single user.
      Specified by:
      compute in interface VertexMetric<U>
      Parameters:
      graph - The graph.
      user - The user to compute.
      Returns:
      the value of the metric.
    • averageValue

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

      private double computeDirected​(DirectedGraph<U> directedGraph, U user)
      Computes the degree of the user in a directed graph.
      Parameters:
      directedGraph - The directed graph to take.
      user - The user.
      Returns:
      the corresponding degree value.
    • computeUndirected

      private double computeUndirected​(UndirectedGraph<U> undirectedGraph, U user)
      Computes the degree of the user in an undirected graph.
      Parameters:
      undirectedGraph - The undirected graph to take.
      user - The user.
      Returns:
      the degree of the user in that graph.