# Which algorithms are implemented in community detection based on AdjacencyGraph[.] and WeightedAdjacencyGraph[.]?

The following code generates two distinct community structures: one uses a simple adjacency matrix (with 1 and 0), another uses a weighted adjacency graph (with positive real numbers). I like to know which Algorithms Mathematica implements in each case, and where they are documented (references to articles). This answer gives a relevant explanation for my question but it does not give any reference explaining the method. There must be a reference to algorithms implemented!

ClearAll[mat, g, wmat, wag];

SeedRandom[123];

(* communities from an unweighted adjacency graph *)
mat = RandomInteger[{0, 1}, {25, 25}];
g = AdjacencyGraph[mat /. (0. -> Infinity), VertexLabels -> "Name"];
WeightedGraphQ[g]
FindGraphCommunities[g]

(* communities from a weighted adjacency graph *)
wmat = (mat*RandomReal[{1, 5}, {25, 25}]) /. (0. -> Infinity);
wag = WeightedAdjacencyGraph[wmat, DirectedEdges -> True,
VertexLabels -> "Name"];
WeightedGraphQ[wag]
FindGraphCommunities[wag]

Row[{CommunityGraphPlot[g, ImageSize -> 350],
CommunityGraphPlot[wag, ImageSize -> 350]}]


In the following link S. Horvat was also raising the same question like mine:

https://community.wolfram.com/groups/-/m/t/1267979

• Why don't you use IGraph/M? All the community detection algorithms have references, and the code is open. Commented Nov 13, 2023 at 18:28