cdlib.ensemble.grid_execution¶
- cdlib.ensemble.grid_execution(graph: Graph, method: Callable[[Graph, dict], object], parameters: list) tuple ¶
Instantiate the specified community discovery method performing a grid search on the parameter set.
- Parameters:
method – community discovery method (from nclib.community)
graph – networkx/igraph object
parameters – list of Parameter and BoolParameter objects
- Returns:
at each call the generator yields a tuple composed by the current configuration and the obtained communities
- Example:
>>> import networkx as nx >>> from cdlib import algorithms, ensemble >>> g = nx.karate_club_graph() >>> resolution = ensemble.Parameter(name="resolution", start=0.1, end=1, step=0.1) >>> for communities in ensemble.grid_execution(graph=g, method=algorithms.louvain, parameters=[resolution]): >>> print(communities)