module documentation

Python级别稀疏矩阵操作的实现。

函数 _convert_mode_argument 未记录
函数 _graph_from_sparse_matrix 从稀疏矩阵构造图,无权。
函数 _graph_from_weighted_sparse_matrix 从稀疏矩阵构造加权图
函数 _maybe_halve_diagonal 如果且仅当给定条件为真时,将给定SciPy稀疏矩阵的对角线中的所有项减半。
常量 _SUPPORTED_MODES 未记录
def _convert_mode_argument(mode): (source)

未记录

def _graph_from_sparse_matrix(klass, matrix, mode='directed', loops='once'): (source)

从稀疏矩阵构建图,无权重。

@param loops: 指定应如何处理矩阵的对角线:

  • 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'): (source)

从稀疏矩阵构建加权图

注意:当然,你无法用一个单一的邻接矩阵来表示一个完全通用的加权多重图,所以我们在这里也不尝试这样做。

@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.
def _maybe_halve_diagonal(m, condition): (source)

如果且仅当给定条件为真时,将给定SciPy稀疏矩阵对角线上的所有项减半。

返回行、列和数据数组。

_SUPPORTED_MODES: tuple[str, ...] = (source)

未记录

('directed', 'undirected', 'max', 'min', 'plus', 'lower', 'upper')