conns_to_am#

conns_to_am(*args, **kwargs)[source]#

Converts a list of connections into a Scipy sparse adjacency matrix

Parameters:
  • conns (array_like, N x 2) – The list of site-to-site connections

  • shape (list, optional) – The shape of the array. If none is given then it is taken as 1 + the maximum value in conns.

  • force_triu (bool) – If True (default), then all connections are assumed undirected, and moved to the upper triangular portion of the array

  • drop_diag (bool) – If True (default), then connections from a site and itself are removed.

  • drop_dupes (bool) – If True (default), then all pairs of sites sharing multiple connections are reduced to a single connection.

  • drop_negs (bool) – If True (default), then all connections with one or both ends pointing to a negative number are removed.

Returns:

am – A sparse adjacency matrix in COO format

Return type:

ndarray