cdlib.viz.typicality_distribution¶
- cdlib.viz.typicality_distribution(lc: LifeCycle, direction: str, width: int = 800, height: int = 500, showlegend: bool = True)¶
绘制给定方向上事件的典型性分布。
- Parameters:
lc – 生命周期对象
direction – 事件的方向,可以是“+”或“-”
width – 图形的宽度,默认为800
height – 图形的高度,默认为500
showlegend – 显示图例,默认为 True
- Returns:
一个matplotlib图形
- 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 = typicality_distribution(events, "+") >>> fig.show()