Class Density<U>

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

public class Density<U>
extends java.lang.Object
implements GraphMetric<U>
Computes the density of a graph. It is considered that there are not self-loops in the graph.
  • Constructor Summary

    Constructors 
    Constructor Description
    Density()  
  • Method Summary

    Modifier and Type Method Description
    private double calculateDirected​(DirectedGraph<U> graph)
    Computes the density of a directed graph.
    private double calculateUndirected​(UndirectedGraph<U> graph)
    Computes the density of an undirected graph.
    double compute​(Graph<U> graph)
    Computes the value.

    Methods inherited from class java.lang.Object

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

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

      private double calculateDirected​(DirectedGraph<U> graph)
      Computes the density of a directed graph.
      Parameters:
      graph - The directed graph.
      Returns:
      The density.
    • calculateUndirected

      private double calculateUndirected​(UndirectedGraph<U> graph)
      Computes the density of an undirected graph.
      Parameters:
      graph - The undirected graph.
      Returns:
      The density.