grid_execution(graph, method, parameters)¶
Instantiate the specified community discovery method performing a grid search on the parameter set.
- method – community discovery method (from nclib.community)
- graph – networkx/igraph object
- parameters – list of Parameter and BoolParameter objects
at each call the generator yields a tuple composed by the current configuration and the obtained communities
>>> 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)