ash_model.utils.matrices.adjacency_matrix

ash_model.utils.matrices.adjacency_matrix(h, start=None, end=None, return_mapping=False)[source]

Returns the adjacency matrix of the ASH object. The adjacency matrix is a sparse matrix where rows and columns represent nodes, and the value is 1 if there is a hyperedge connecting the two nodes, 0 otherwise.

Parameters:
  • h (ASH) – The ASH object to be converted.

  • start (int | None) – The start time of the projection (optional).

  • end (int | None) – The end time of the projection (optional).

  • return_mapping (bool) –

Returns:

A sparse matrix representing the adjacency matrix of the ASH.

Return type:

scipy.sparse.csr_matrix | Tuple[scipy.sparse.csr_matrix, Dict[int, int]]