conns_to_am

openpnm.topotools.conns_to_am(conns, shape=None, force_triu=True, drop_diag=True, drop_dupes=True, drop_negs=True)[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 inferred from the maximum value in conns array.

  • 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.