本文簡要介紹 python 語言中 scipy.sparse.csgraph.structural_rank
的用法。
用法:
scipy.sparse.csgraph.structural_rank(graph)#
計算具有給定稀疏模式的圖(矩陣)的結構等級。
矩陣的結構秩是對應二分圖的最大橫向中的條目數,是矩陣數值秩的上界。如果可以排列元素以形成對角線zero-free,則圖具有完整的結構等級。
- graph: 稀疏矩陣
輸入稀疏矩陣。
- rank: int
稀疏圖的結構秩。
參數 ::
返回 ::
參考:
[1]I. S. Duff,“計算結構 index ”,SIAM J. Alg。光盤。方法,卷。 7, 594 (1986)。
例子:
>>> 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
相關用法
- Python SciPy csgraph.shortest_path用法及代碼示例
- Python SciPy csgraph.csgraph_to_dense用法及代碼示例
- Python SciPy csgraph.min_weight_full_bipartite_matching用法及代碼示例
- Python SciPy csgraph.minimum_spanning_tree用法及代碼示例
- Python SciPy csgraph.breadth_first_order用法及代碼示例
- Python SciPy csgraph.connected_components用法及代碼示例
- Python SciPy csgraph.dijkstra用法及代碼示例
- Python SciPy csgraph.breadth_first_tree用法及代碼示例
- Python SciPy csgraph.csgraph_from_dense用法及代碼示例
- Python SciPy csgraph.floyd_warshall用法及代碼示例
- Python SciPy csgraph.bellman_ford用法及代碼示例
- Python SciPy csgraph.csgraph_to_masked用法及代碼示例
- Python SciPy csgraph.maximum_flow用法及代碼示例
- Python SciPy csgraph.csgraph_masked_from_dense用法及代碼示例
- Python SciPy csgraph.reconstruct_path用法及代碼示例
- Python SciPy csgraph.johnson用法及代碼示例
- Python SciPy csgraph.maximum_bipartite_matching用法及代碼示例
- Python SciPy csgraph.depth_first_order用法及代碼示例
- Python SciPy csgraph.csgraph_from_masked用法及代碼示例
- Python SciPy csgraph.construct_dist_matrix用法及代碼示例
- Python SciPy csgraph.reverse_cuthill_mckee用法及代碼示例
- Python SciPy csgraph.depth_first_tree用法及代碼示例
- Python SciPy csgraph.laplacian用法及代碼示例
- Python SciPy csc_array.diagonal用法及代碼示例
- Python SciPy csc_matrix.nonzero用法及代碼示例
注:本文由純淨天空篩選整理自scipy.org大神的英文原創作品 scipy.sparse.csgraph.structural_rank。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。