ash_model.measures.s_intersections

ash_model.measures.s_intersections(h, s, start=None, end=None)[source]

Count the number of s-overlap intersections (edges) in the hypergraph’s s-overlap line graph.

Parameters:
  • h (ASH) – an ASH instance

  • s (int) – minimum hyperedge overlap size

  • start (int | None) – optional start time (inclusive)

  • end (int | None) – optional end time (inclusive)

Returns:

number of intersections of size >= s

Return type:

int

Examples

>>> import numpy as np, networkx as nx
>>> from ash_model.utils.networkx import from_networkx_maximal_cliques_list
>>> Gs = [nx.barabasi_albert_graph(100, 3, seed=i) for i in range(10)]
>>> rng = np.random.default_rng(42)
>>> for G in Gs:
...     for n in G.nodes():
...         G.nodes[n]['color'] = 'red' if rng.integers(0, 2) == 0 else 'blue'
>>> h = from_networkx_maximal_cliques_list(Gs)
>>> s_intersections(h, 1, start=0, end=0)
2091