scipy.sparse.csgraph.structural_rank

scipy.sparse.csgraph.structural_rank(graph)

计算具有给定稀疏模式的图(矩阵)的结构秩。

矩阵的结构秩是相应二部图的最大横截中的项数,是矩阵的数值秩的上界。如果可以置换元素以使对角线为零,则图的结构秩是满的。

0.19.0 新版功能.

参数
graph稀疏矩阵

输入稀疏矩阵。

退货
rank集成

稀疏图的结构秩。

参考文献

1

“计算结构指数”,西姆·J·阿尔格(SIAM J.Alg)。光盘。“冰毒”,第7卷,594卷(1986)。

2

http://www.cise.ufl.edu/research/sparse/matrices/legend.html

示例

>>> from scipy.sparse import csr_matrix
>>> from scipy.sparse.csgraph import structural_rank
>>> graph = [
... [0, 1, 2, 0],
... [1, 0, 0, 1],
... [2, 0, 0, 3],
... [0, 1, 3, 0]
... ]
>>> graph = csr_matrix(graph)
>>> print(graph)
  (0, 1)    1
  (0, 2)    2
  (1, 0)    1
  (1, 3)    1
  (2, 0)    2
  (2, 3)    3
  (3, 1)    1
  (3, 2)    3
>>> structural_rank(graph)
4