Visualization

The ash_model.viz module provides functions for visualizing hypergraph properties, both for static snapshots and temporal evolution.

Static Plots

Functions for visualizing static hypergraph properties.

ash_model.viz.static.plot_s_degrees(h, smax, loglog=True, **kwargs)[source]

Plot the s-degree distribution of a hypergraph.

A line for each s will be plotted, from 1 to smax inclusive. Matplotlib plotting parameters (e.g., color) can be passed as kwargs.

Parameters:
  • h (ASH) – ASH instance

  • smax (int) – Maximum value of s

  • loglog (bool) – If True, plot in log-log scale

  • kwargs (object) – Matplotlib keyword arguments (e.g., ax, color, linewidth)

Returns:

The matplotlib axes object

Return type:

object

ash_model.viz.static.plot_hyperedge_size_distribution(h, max_size=None, min_size=None, **kwargs)[source]

Plot the distribution of hyperedge sizes in a hypergraph.

min_size and max_size can be used to filter out hyperedges. Matplotlib plotting parameters (e.g., color) can be passed as kwargs.

Parameters:
  • h (ASH) – ASH instance

  • max_size (int | None) – Maximum size of hyperedges to be plotted (optional)

  • min_size (int | None) – Minimum size of hyperedges to be plotted (optional)

  • kwargs (object) – Matplotlib keyword arguments (e.g., ax, color, alpha)

Returns:

The matplotlib axes object

Return type:

object

ash_model.viz.static.plot_degree_distribution(h, loglog=True, **kwargs)[source]

Plot the degree distribution of an ASH hypergraph.

The default is to draw a log-log plot. Matplotlib plotting parameters (e.g., color) can be passed as kwargs.

Parameters:
  • h (ASH) – ASH instance

  • loglog (bool) – If True, plot in log-log scale

  • kwargs (object) – Matplotlib keyword arguments (e.g., ax, color, alpha)

Returns:

The matplotlib axes object

Return type:

object

ash_model.viz.static.plot_s_ranks(h, smax, loglog=True, **kwargs)[source]

Plot the s-degree rank distribution of a hypergraph.

A line for each s will be plotted, from 1 to smax inclusive. Matplotlib plotting parameters (e.g., color) can be passed as kwargs.

Parameters:
  • h (ASH) – ASH instance

  • smax (int) – Maximum value of s

  • loglog (bool) – If True, plot in log-log scale

  • kwargs (object) – Matplotlib keyword arguments (e.g., ax, color, label)

Returns:

The matplotlib axes object

Return type:

object

Temporal Plots

Functions for visualizing temporal dynamics and evolution of hypergraphs.

ash_model.viz.temporal.plot_hyperedge_activity_series(h, normalize=False, **kwargs)[source]

Plot the number of active hyperedges at each temporal snapshot.

Parameters:
  • h (ASH) – ASH instance.

  • normalize (bool) – If True divide activity by the maximum (y in [0,1]).

  • kwargs – Matplotlib customisation (color, ax …).

Returns:

Matplotlib Axes with the line plot.

ash_model.viz.temporal.plot_node_activity_series(h, *, normalize=False, **kwargs)[source]

Plot the activity over time for selected nodes.

Parameters:
  • h (ASH) – ASH instance.

  • normalize (bool) – If True divide node’s activity by its maximum (y in [0,1]).

  • kwargs – Matplotlib customisation (color, ax …).

Returns:

Matplotlib Axes with the line plot.

ash_model.viz.temporal.plot_presence_timeline(h, *, hyperedges=None, nodes=None, **kwargs)[source]

Plot a presence timeline (Gantt‑like) for given hyperedges or nodes.

One of hyperedges or nodes must be provided. If both are provided, hyperedges takes precedence.

Parameters:
  • h (ASH) – ASH instance.

  • hyperedges (Iterable[int] | None) – Iterable of hyperedge IDs to plot.

  • nodes (Iterable[int] | None) – Iterable of node IDs to plot.

  • kwargs – Matplotlib customisation (color, ax …).

Returns:

Matplotlib Axes with the timeline plot.

ash_model.viz.temporal.plot_inter_event_time_distribution(h, **kwargs)[source]

Plot distribution of inter‑event times for hyperedge activations.

We define an activation as a + event produced by ASH.stream_interactions. Inter‑event gaps are differences between consecutive activation times (across all hyperedges).

Parameters:
  • h (ASH) – ASH instance.

  • kwargs – Matplotlib bar customisation (color, ax …).

Returns:

Axes

ash_model.viz.temporal.plot_hyperedge_lifespan_distribution(h, **kwargs)[source]

Histogram of hyperedge lifespans (duration in snapshots).

For each hyperedge we compute (last_presence - first_presence + 1).

Parameters:
  • h (ASH) – ASH instance.

  • kwargs – Matplotlib customisation (bins, color, ax …).

Returns:

Axes

ash_model.viz.temporal.plot_node_lifespan_distribution(h, **kwargs)[source]

Histogram of node lifespans (duration in snapshots).

For each node we compute (last_presence - first_presence + 1).

Parameters:
  • h (ASH) – ASH instance.

  • kwargs – Matplotlib customisation (bins, color, ax …).

Returns:

Axes