LFR module

LFR.get_ARI_LFR(mu, av_deg)[source]

Generate an LFR benchmark graph, apply Ricci Flow-based community detection, and compute ARI.

This function creates a Lancichinetti-Fortunato-Radicchi (LFR) benchmark graph with given parameters, applies Ollivier-Ricci curvature and Ricci Flow, and evaluates the clustering performance using Adjusted Rand Index (ARI).

Parameters:
  • mu (float) – Mixing parameter (fraction of links connecting different communities).

  • av_deg (int) – Average degree of nodes in the graph.

Returns:

Adjusted Rand Index (ARI) for the detected communities.

Return type:

float

LFR.test_LFR()[source]

See Figure 8(a) from Ni et al., “Community Detection on Networks with Ricci Flow”.

This function tests Ricci Flow-based community detection on LFR benchmark graphs for different values of the mixing parameter \(\mu\). The results are visualized in a plot showing ARI as a function of \(\mu\) for different average degrees.

The experiment is run for the following values: - \(\mu = [0.25, 0.3, 0.35, 0.4, 0.45, 0.5]\) - Average degrees: [20, 25, 30, 35, 40]

The final results are saved as LFR.png in the tests/LFRResults directory.