get_adjacency_matrix#
- Cubic.get_adjacency_matrix(fmt='coo')#
Adjacency matrix in the specified sparse format, with throat IDs indicating the non-zero values.
- Parameters:
fmt (str, default is 'coo') –
- The sparse storage format to return. Options are:
’coo’ : This is the native format of OpenPNM’s data ‘lil’ : Enables row-wise slice of the matrix ‘csr’ : Favored by most linear algebra routines ‘dok’ : Enables subscript access of locations
Notes
This method will only create the requested matrix in the specified format if one is not already saved on the object. If not present, this method will create and return the matrix, as well as store it for future use.
To obtain a matrix with weights other than throat IDs at each non-zero location use
create_adjacency_matrix
.To obtain the non-directed graph, with only upper-triangular entries, use
sp.sparse.triu(am, k=1)
.