The optimal partition for the simple graph we are using in this section is similar to the one obtained with connected components or Label Propagation algorithms: nodes A, B, and C are in their own partition while nodes D to G are in another community.
With m = 9, the modularity in that case is as follows:
Q = 1/18 (
2 * (AAB - kAkB / 18 + AAC - kAkC / 18 + ABC - kBkC / 18)
+ 2 * (ADE - kDkE / 18 + ADG - kDkG / 18 + ADF - kDkF / 18 + AEF - kEkF / 18 + AEG - kEkG / 18 + AGF - kGkF / 18 )
) + Qdiag
= 1 / 18 * 2 * (
1 - 2 * 2 / 18 + 1 - 2 * 3 / 18 + 1 - 2 * 3 / 18
+ 1 - 3 * 3 / 18 + 1 - 3 * 3 / 18 + 0 - 3 * 2 / 18 + 1 - 3 * 2 / 18 + 1 - 3 * 3 / 18 + 1 - 3 * 2 / 18
) - 0.148
= 0.364 > 0
Since our graph is undirected, we can afford to double the term corresponding to the relationship between A and B (A - B), instead of summing the terms A -> B and B ...