There was an error while loading. Please reload this page.
Our algorithms typically take an adjacency matrix in a sparse CSR format as entry .
It is useful to understand how this format works in order to code basic graph routines:
Assume you have instanciated a csr_matrix A representing the adjacency of the graph G = (V, E) with the usual triplet of np.ndarray:
row = np.array([...])
col = np.array([...])
data = np.array([...])
such that for any k A[row[k], col[k]] = data[k].
A[row[k], col[k]] = data[k]
The csr_matrix has instanciated three main attributes:
indptr = np.array([...])
indices = np.array([...])
indices and data have the same elements as the arguments col and data but sorted such that:
indices[indptr[i]:indptr[i+1]]
data[indptr[i]:indptr[i+1]]