Community metrics contain information about graph structure. Different kinds of such algorithms were covered in Chapter 7, Community Detection and Similarity Measures. These included the strongly and weakly connected components to spot isolated groups of nodes and the label propagation and Louvain algorithm for more subtle community identification.
In many cases, we can safely assume that two nodes in the same community are more likely to be connected. This concept is illustrated in the following diagram:
The link between B and C is more likely to be created next, since B and C are in the same community, unlike nodes B and D. In this case, the scoring function would be the following:
score(u, v) = 1 if u and v are in the same community, 0 otherwise
In these situations, we can use the sameCommunity function of the GDS plugin. This will simply check whether two nodes are in the same community, assuming the community is stored as a node property for each node:
MATCH...