cdlib.viz.plot_flow¶
- cdlib.viz.plot_flow(lc: LifeCycle, node_focus: str | None = None, slice: tuple | None = None) plotly.graph_objects.Figure¶
Plot the flow of a lifecycle
- Parameters:
lc – the lifecycle object
node_focus – plot only the flows involving this group. Defaults to None.
slice – plot only a slice of the lifecycle. Defaults to all.
- Returns:
a plotly figure
- Example:
>>> from cdlib import TemporalClustering, LifeCycle >>> from cdlib import algorithms >>> from cdlib.viz import plot_flow >>> from networkx.generators.community import LFR_benchmark_graph >>> tc = TemporalClustering() >>> for t in range(0, 10): >>> g = LFR_benchmark_graph( >>> n=250, >>> tau1=3, >>> tau2=1.5, >>> mu=0.1, >>> average_degree=5, >>> min_community=20, >>> seed=10, >>> ) >>> coms = algorithms.louvain(g) # here any CDlib algorithm can be applied >>> tc.add_clustering(coms, t) >>> events = LifeCycle(tc) >>> events.compute_events("facets") >>> fig = plot_flow(events) >>> fig.show()