Skip to main content

louvain_communities_with_progress

Function louvain_communities_with_progress 

Source
pub fn louvain_communities_with_progress<F>(
    graph: &SqliteGraph,
    max_iterations: usize,
    progress: &F,
) -> Result<Vec<Vec<i64>>, SqliteGraphError>
Expand description

Louvain method for community detection with progress callback reporting.

This is the progress-reporting variant of louvain_communities. See that function for full algorithm documentation.

§Arguments

  • graph - The graph to analyze
  • max_iterations - Maximum number of iterations
  • progress - Callback for progress updates

§Progress Reporting

  • Reports progress for each iteration pass: “Louvain pass X”
  • Total is None (convergence unknown)
  • Calls on_complete() when finished or converged
  • Calls on_error() if an error occurs

§Example

use sqlitegraph::{SqliteGraph, algo::louvain_communities_with_progress};
use sqlitegraph::progress::NoProgress;

let graph = SqliteGraph::open_in_memory()?;
// ... add nodes and edges ...
let progress = NoProgress;
let communities = louvain_communities_with_progress(&graph, 10, &progress)?;