I'm using the greedy modularity algorithm from networkx in a project and I need to dissect the paper of this algorithm.
From what I understand, you begin the algorithm putting every vertex into a community of one, calculating the modularity for the network using this separation into communities and then changing the network and incrementing the modularity using the algorithm steps in a way that the new modularity of the graph is the modularity of the new separation.
But from reading the paper and doing some calculations it seems that the algorithm doesn't increment enough to give us the modularity of the new separation.
Starting the algorithm, using equation (7) we will have
After the first increment (joining two vertices that are connected), if we calculate Q by the equation (7) we will have, if the vertices are v1 and v2 and the community they are in is called i
And if we calculate the new modularity using the first increment of the algorithm, we will only have
Which is definitely different from the previous one. So how is this difference compensated? Am I calculating this wrong?


