Python 第三方模块 科学计算 SciPy模块7 稀疏矩阵2

本文深入探讨了Python的Scipy库中用于科学计算的 Csgraph 和 Linalg 子模块。主要内容包括Csgraph子模块的其他功能,如图论相关操作,以及Linalg子模块的矩阵运算、范数计算、线性方程组求解和矩阵分解等线性代数基本操作。
摘要由CSDN通过智能技术生成

十三.Csgraph子模块
2.内容
(4)其他:

分析稀疏图中的"连通分量"(Connected Component):[<n_components>,<labels>=]scipy.sparse.csgraph.connected_components(<csgraph>[,directed=True,connection='weak',return_labels=True])
  #参数说明:
    csgraph:指定稀疏图;为N×N sparse matrix/N×N ndarray/N×N dense matrix
    directed:指定<csgraph>是否为有向图;bool
    connection:指定有向图使用的连通类型;"weak"/"strong"
      #Nodes i and j are strongly connected if a path exists both from i to j and from j to i
      #对无向图(directed=False时)无效
    return_labels:指定是否返回<labels>;bool
    n_components:返回图中的连通分量数;int
    labels:返回连通分量的标签;1×N ndarray

######################################################################################################################

求稀疏有向图的"拉普拉斯矩阵"(Laplacian Matrix):[<lap>,<diag>=]scipy.sparse.csgraph.laplacian(<csgraph>[,normed=False,return_diag=False,use_out_degree=False])
  #参数说明:<csgraph>同scipy.sparse.csgraph.connected_components()
	normed:True,则求"对称正规化拉普拉斯矩阵"(Symmetric Normalized Laplacian Matrix)
	return_diag:指定是否返回<diag>;bool
	use_out_degree:True,使用"出度"(Out-Degree)False,使用"入度"(In-Degree)
	  #仅当<csgraph>非对称时有效
	lap:返回拉普拉斯矩阵;为N×N sparse matrix/N×N ndarray
	diag:返回<lap>的对角线;1×N ndarray

######################################################################################################################"最小生成树"(Minimum Spanning Tree):[<span_tree>=]scipy.sparse.csgraph.minimum_spanning_tree(<csgraph>[,overwrite=False])
  #参数说明:其他参数同scipy.sparse.csgraph.shortest_path()
    span_tree:返回最小生成树;为N×N CSR sparse matrix

######################################################################################################################

执行"RCM算法"(Reverse-Cuthill McKee Algorithm):[<perm>=]scipy.sparse.csgraph.reverse_cuthill_mckee(<graph>[,symmetric_mode=False])
  #参数说明:
    graph:指定原稀疏图;为CSC sparse matrix/CSR sparse matrix
    symmetric_mode:指定<graph>是否保证对称;bool
    perm:返回置换矩阵;为ndarray

######################################################################################################################

求解"最大流问题"(Maximum Flow Problem):[<res>=]scipy.sparse.csgraph.maximum_flow(<csgraph>,<source>,<sink>)
  #参数说明:
    csgraph:指定原稀疏图;为CSR sparse matrix
    source:指定"源点"/"发点"(Source Vertex);int
    sink:指定"汇点"/"收点"(Sink Vertex);int
    res:返回最大流;为MaximumFlowResult

######################################################################################################################

Returns a matching of a bipartite graph whose cardinality is as least that of any given matching of the graph:[<perm>=]scipy.sparse.csgraph.maximum_bipartite_matching(<graph>[,perm_type='row'])

######################################################################################################################

Returns the minimum weight full matching of a bipartite graph:[<row_ind>,<col_ind>=]scipy.sparse.csgraph.min_weight_full_bipartite_matching(<biadjacency_matrix>[,maximize=False])

######################################################################################################################"Structural Rank":[<rank>=]scipy.sparse.csgraph.structural_rank(<graph>)
  #参数说明:其他参数同scipy.sparse.csgraph.breadth_first_order()
    graph:指定稀疏矩阵;为sparse matrix
    rank:返回结果;int

十四.Linalg子模块
1.简介:

其中定义
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值