Class Assortativity<U>
java.lang.Object
es.uam.eps.ir.relison.sna.metrics.graph.Assortativity<U>
- Type Parameters:
U- Type of the users.
- All Implemented Interfaces:
GraphMetric<U>
- Direct Known Subclasses:
DegreeAssortativity
public class Assortativity<U> extends java.lang.Object implements GraphMetric<U>
Class for computing the assortativity of scalar values for a graph.
Reference: M.E.J. Newman. Assortative mixing in networks. Physical Review Letters 89(20), 208701 (2002)
-
Field Summary
-
Constructor Summary
Constructors Constructor Description Assortativity(java.util.function.ToDoubleBiFunction<U,Graph<U>> function)Constructor. -
Method Summary
Modifier and Type Method Description doublecompute(Graph<U> graph)Computes the value.private doublecomputeDirected(DirectedGraph<U> graph, java.util.Map<U,java.lang.Double> res)Computes the assortativity for directed graphs.private doublecomputeUndirected(UndirectedGraph<U> graph, java.util.Map<U,java.lang.Double> res)Computes the assortativity for undirected graphs.
-
Field Details
-
function
Function for computing the values for each node.
-
-
Constructor Details
-
Assortativity
Constructor.- Parameters:
function- function to apply to the users.
-
-
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.
-
computeDirected
Computes the assortativity for directed graphs.- Parameters:
graph- the graphres- the values for each node- Returns:
- the assortativity of the directed graph.
-
computeUndirected
Computes the assortativity for undirected graphs.- Parameters:
graph- the graphres- the values for each node- Returns:
- the assortativity of the undirected graph.
-