cdlib.viz.typicality_distribution

cdlib.viz.typicality_distribution(lc: LifeCycle, direction: str, width: int = 800, height: int = 500, showlegend: bool = True)

Plot the distribution of typicality of events in a given direction.

Parameters:
  • lc – the lifecycle object

  • direction – the direction of the events, either “+” or “-”

  • width – the width of the figure, defaults to 800

  • height – the height of the figure, defaults to 500

  • showlegend – show the legend, defaults to True

Returns:

a matplotlib 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 = typicality_distribution(events, "+")
>>> fig.show()