xugrid.Ugrid1d.format_connectivity_as_dense#

static Ugrid1d.format_connectivity_as_dense(sparse_connectivity: csr_matrix | coo_matrix | ndarray)#

Return a rectangular representation of a sparse (CSR or COO) connectivity array. The number of columns in the dense array will be determined by the maximum number of connections for any row in the sparse matrix. Irregular connectivities are represented by a fill value of -1.

Parameters:

sparse_connectivity (scipy.sparse.csr_matrix, scipy.sparse.coo_matrix, np.ndarray) – Connectivity in CSR or COO form. Connectivities already in dense rectangular form are returned as-is.

Returns:

dense – Connectivity in rectangular form.

Return type:

np.ndarray