cdlib.lifecycles.flow_null¶
- cdlib.lifecycles.flow_null(lc: object, target: str, direction: str, min_branch_size: int = 1, iterations: int = 1000) dict¶
将流程与空模型进行比较。每个流程的每个分支都与相同大小的空分支进行比较。 空模型是通过从参考分区中随机抽样元素iterations次生成的。 空模型的平均值和标准差用于计算每个分支的z分数, 然后用于计算p值。
- Parameters:
lc – 一个CommunityMatching对象
target – 目标集标识符
direction – 时间方向
min_branch_size – 被视为分支的最小大小
iterations – 用于生成空模型的随机抽取次数
- Returns:
一个以集合标识符为键,以均值、标准差和p值为值的字典
- Example:
>>> from cdlib import TemporalClustering, LifeCycle >>> from cdlib import algorithms >>> from cdlib.lifecycles.algorithms import flow_null >>> 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") >>> validated = flow_null(events, "0_2", "+")