Class ModularityComplement<U>
java.lang.Object
es.uam.eps.ir.relison.sna.metrics.communities.graph.ModularityComplement<U>
- Type Parameters:
U- The type of the users.
- All Implemented Interfaces:
CommunityMetric<U>
public class ModularityComplement<U> extends java.lang.Object implements CommunityMetric<U>
Computes the modularity complement of a graph, given the communities.
References:
- J. Sanz-Cruzado, P. Castells. Beyond accuracy in link prediction. 3rd Workshop on Social Media for Personalization and Search (SoMePEaS 2019).
- J. Sanz-Cruzado, S.M. Pepa, P. Castells. Structural novelty and diversity in link prediction. 0th International Workshop on Modeling Social Media (MSM 2018) at The Web Conference (WWW 2018)
-
Field Summary
Fields Modifier and Type Field Description private Modularity<U>modularityModularity calculator. -
Constructor Summary
Constructors Constructor Description ModularityComplement()Constructor. -
Method Summary
Modifier and Type Method Description doublecompute(Graph<U> graph, Communities<U> comm)Computes the value of the metric in the graph.private doublecomputeDirected(DirectedGraph<U> graph, Communities<U> comm, MultiGraph<java.lang.Integer> commGraph)Computes the value of the modularity for a directed graph.private doublecomputeUndirected(UndirectedGraph<U> graph, Communities<U> comm, MultiGraph<java.lang.Integer> commGraph)Computes the value of the modularity for an undirected graph.
-
Field Details
-
modularity
Modularity calculator.
-
-
Constructor Details
-
ModularityComplement
public ModularityComplement()Constructor.
-
-
Method Details
-
compute
Description copied from interface:CommunityMetricComputes the value of the metric in the graph.- Specified by:
computein interfaceCommunityMetric<U>- Parameters:
graph- Graph.comm- Communities of the graph.- Returns:
- the value of the metric.
-
computeDirected
private double computeDirected(DirectedGraph<U> graph, Communities<U> comm, MultiGraph<java.lang.Integer> commGraph)Computes the value of the modularity for a directed graph.- Parameters:
graph- The directed graph.comm- The communities.commGraph- The community graph.- Returns:
- The value of the modularity.
-
computeUndirected
private double computeUndirected(UndirectedGraph<U> graph, Communities<U> comm, MultiGraph<java.lang.Integer> commGraph)Computes the value of the modularity for an undirected graph.- Parameters:
graph- The undirected graph.comm- The communities.commGraph- The community graph.- Returns:
- The value of the modularity of the graph.
-