pub fn parallel_louvain_communities_result<N, E, Ix>(
graph: &Graph<N, E, Ix>,
max_iterations: usize,
) -> CommunityResult<N>Expand description
Detects communities using parallel Louvain method (modern API)
This function returns the standardized CommunityResult type that provides
multiple ways to access the community structure. Uses parallel processing
to accelerate community detection on large graphs.
§Arguments
graph- The undirected graph to analyzemax_iterations- Maximum number of optimization iterations
§Returns
- A
CommunityResultwith community structure from parallel Louvain
§Time Complexity
O(m * log n / p) where m is the number of edges, n is the number of nodes, and p is the number of parallel threads. Actual speedup depends on graph structure.
§Space Complexity
O(n) for storing community assignments and auxiliary data structures.
§Example
ⓘ
// This requires the "parallel" feature to be enabled
use scirs2_graph::{Graph, parallel_louvain_communities_result};
let mut graph: Graph<i32, f64> = Graph::new();
// ... add nodes and edges ...
let result = parallel_louvain_communities_result(&graph, 50);
println!("Parallel Louvain modularity: {:.4}", result.quality_score.unwrap_or(0.0));
println!("Found {} communities", result.num_communities);