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 doublecalculateDirected(DirectedGraph<U> graph)Computes the density of a directed graph.private doublecalculateUndirected(UndirectedGraph<U> graph)Computes the density of an undirected graph.doublecompute(Graph<U> graph)Computes the value.
-
Constructor Details
-
Density
public Density()
-
-
Method Details
-
compute
Description copied from interface:GraphMetricComputes the value.- Specified by:
computein 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.
-