ash_model.multiego.get_multiego

ash_model.multiego.get_multiego(h, U, start=None, end=None)[source]

Extract the Multi-Ego Network for a set of ego nodes U within a time window.

A Multi-Ego Network contains all hyperedges that include at least one node from the ego set U. This generalizes the single-node ego network (ASH.star()) to multiple root nodes.

Parameters:
  • h (ASH) – an ASH instance

  • U (Set[int]) – set of ego nodes (root nodes)

  • start (int | None) – start time of the query window (optional). If None, considers all time periods.

  • end (int | None) – end time of the query window (inclusive, optional). If None, only start time is considered (if start is provided), otherwise all time periods.

Returns:

list of hyperedges (as sets of node IDs) forming the Multi-Ego Network

Return type:

List[Set[int]]

Examples

>>> h = ASH()
>>> # ... add hyperedges ...
>>> U = {1, 2}  # Two ego nodes
>>> multiego = get_multiego(h, U)  # All time periods
>>> multiego = get_multiego(h, U, start=0)  # Single snapshot
>>> multiego = get_multiego(h, U, start=0, end=5)  # Time window [0,5]
>>> print(f"Multi-Ego Network contains {len(multiego)} hyperedges")