module documentation
Python级别稀疏矩阵操作的实现。
| 函数 | _convert |
未记录 |
| 函数 | _graph |
从稀疏矩阵构造图,无权。 |
| 函数 | _graph |
从稀疏矩阵构造加权图 |
| 函数 | _maybe |
如果且仅当给定条件为真时,将给定SciPy稀疏矩阵的对角线中的所有项减半。 |
| 常量 | _SUPPORTED |
未记录 |
从稀疏矩阵构建图,无权重。
@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.