ash_model.utils.matrices.incidence_matrix

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

Returns the incidence matrix of the ASH object. The incidence matrix is a sparse matrix where rows represent nodes and columns represent hyperedges. The value is 1 if the node belongs to the hyperedge, 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 binary incidence matrix of the ASH.

Return type:

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