cdlib.viz.plot_community_graph

plot_community_graph(graph, partition, figsize=(8, 8), node_size=200, plot_overlaps=False, plot_labels=False)

Plot a algorithms-graph with node color coding for communities.

Parameters:
  • graph – NetworkX/igraph graph
  • partition – NodeClustering object
  • figsize – the figure size; it is a pair of float, default (8, 8)
  • node_size – int, default 200
  • plot_overlaps – bool, default False. Flag to control if multiple algorithms memberships are plotted.
  • plot_labels – bool, default False. Flag to control if node labels are plotted.

Example:

>>> from cdlib import algorithms, viz
>>> import networkx as nx
>>> g = nx.karate_club_graph()
>>> coms = algorithms.louvain(g)
>>> viz.plot_community_graph(g, coms)