drop_sites#

drop_sites(am, sites)[source]#

Update adjacency matrix after dropping nodes

Parameters:
  • am (scipy.sparse matrix) – The adjacency matrix of the network in COO format.

  • inds (array_like) – A list of which nodes indices to drop. Can either be integer indices or a boolean mask with True indicating which locations to drop

Returns:

  • am (ndarray) – An updated adjacency matrix with nodes and headless edges removed, and node indices updated accordingly

  • dropped_edges (ndarray) – A boolean array with True values indicating which edges were rendered headless. This can be used to drop invalid edges from other arrays (i.e. array = array[~dropped_edges]).