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.
-
Constructor Details
-
Density
public Density()
-
-
Method Details
-
compute
Description copied from interface:GraphMetric
Computes the value.- Specified by:
compute
in interfaceGraphMetric<U>
- Parameters:
graph
- graph metric.- Returns:
- the value of the metric.
-
calculateDirected
Computes the density of a directed graph.- Parameters:
graph
- The directed graph.- Returns:
- The density.
-
calculateUndirected
Computes the density of an undirected graph.- Parameters:
graph
- The undirected graph.- Returns:
- The density.
-