Hi igraph community,
I have a graph and I want to estimate the modularity (Q) based on the Louvain split of the graph.
In python I used igraph and to compare, I also estimated Q in Matlab.
Based on igraph, the Q is negative (weird) whereas the Q based on the Matlab estimation is possitive.
I would expect differences in the values but not by so far (+ shows modularity, - shows anti-modularity).
Any idea why this happens?
My code and data:
import numpy as np
from igraph import *
A = scipy.io.loadmat('A.mat')['A']
graph = Graph.Weighted_Adjacency(A.tolist(), mode=ADJ_UNDIRECTED, attr="weight", loops=False)
Louvain = graph.community_multilevel(weights=graph.es
Q = graph.modularity(Louvain)
using community_louvain.m: Louvain community detection algorithm
igraph-help mailing list