module documentation
Implementation of Python-level sparse matrix operations.
Function | _convert |
Undocumented |
Function | _graph |
Construct graph from sparse matrix, unweighted. |
Function | _graph |
Construct graph from sparse matrix, weighted |
Function | _maybe |
Halves all items in the diagonal of the given SciPy sparse matrix in coo mode if and only if the given condition is True. |
Constant | _SUPPORTED |
Undocumented |
Construct graph from sparse matrix, unweighted.
@param loops: specifies how the diagonal of the matrix should be handled:
- C{"ignore"} - ignore loop edges in the diagonal
- C{"once"} - treat the diagonal entries as loop edge counts
- C{"twice"} - treat the diagonal entries as I{twice} the number of loop edges
def _graph_from_weighted_sparse_matrix(klass, matrix, mode=ADJ_DIRECTED, attr='weight', loops='once'):
¶
Construct graph from sparse matrix, weighted
NOTE: Of course, you cannot emcompass a fully general weighted multigraph with a single adjacency matrix, so we don't try to do it here either.
- @param loops: specifies how to handle loop edges. When C{False} or
- C{"ignore"}, the diagonal of the adjacency matrix will be ignored. When C{True} or C{"once"}, the diagonal is assumed to contain the weight of the corresponding loop edge. When C{"twice"}, the diagonal is assumed to contain I{twice} the weight of the corresponding loop edge.
Halves all items in the diagonal of the given SciPy sparse matrix in coo mode if and only if the given condition is True.
Returns the row, column and data arrays.