ash_model.paths.randwalks.time_respecting_random_walks

ash_model.paths.randwalks.time_respecting_random_walks(h, s, start_from=None, stop_at=None, start=None, end=None, num_walks=100, walk_length=10, p=1.0, q=1.0, edge=False, threads=-1)[source]

Generate biased, time-respecting random walks on the temporal hypergraph.

This function builds a time-respecting transition matrix and uses it to guide random walks that respect temporal ordering. The approach uses the temporal DAG structure where all edges are forward-in-time transitions (t -> t’ where t’ > t).

Semantics: - All transitions are forward-in-time, respecting strict temporal ordering - Each step moves to a strictly later timestamp - Walks terminate when no forward neighbors exist (reached a temporal sink)

Parameters:
  • h (ASH) – ASH hypergraph object

  • s (int) – Minimum s-incidence threshold

  • start_from (int | str | List[int | str] | None) – Node or edge (or list) to start walks from

  • stop_at (int | str | None) – Node or edge to stop walks at (optional)

  • start (int | None) – Lower temporal bound

  • end (int | None) – Upper temporal bound

  • num_walks (int) – Number of walks per start node/edge

  • walk_length (int) – Length of each walk (number of transitions)

  • p (float) – Return parameter (higher values discourage returning to previous node)

  • q (float) – In-out parameter (higher values favor local exploration)

  • edge (bool) – If True, walk on hyperedge line graph and return TemporalEdge dict

  • threads (int) – Parallel threads for random walk computation (currently unused in custom logic)

Returns:

If edge=False, ndarray of node ID sequences. If edge=True, dict mapping (start, end) to lists of TemporalEdge walks.

Return type:

ndarray | Dict[Tuple[str, str], List[List[TemporalEdge]]]

Examples

# Time-respecting node walks
walks = time_respecting_random_walks(h, s=1, num_walks=100, walk_length=10)

# Time-respecting hyperedge walks
walks_dict = time_respecting_random_walks(h, s=2, num_walks=100, walk_length=10, edge=True)

# Start from specific nodes
walks = time_respecting_random_walks(h, s=1, start_from=[1, 2], num_walks=50)