用法:
cugraph.structure.convert_matrix.from_adjlist(offsets, indices, values=None, create_using=<class 'cugraph.structure.graph_classes.Graph'>)
从表示邻接矩阵 CSR 数据的 cuDF 或 Pandas 系列初始化图形,如果 ‘create_using’ 设置为 cugraph.Graph(默认值),则返回一个新的 cugraph.Graph 对象,如果 ‘create_using’ 设置为 cugraph.DiGraph,则返回 cugraph.DiGraph .
- offsets:cudf.Series、pandas.Series
CSR 邻接矩阵的偏移量。
- indices:cudf.Series、pandas.Series
CSR 邻接矩阵的索引。
- values:cudf.Series 或 pandas.Series,可选(默认 = 无)
CSR 邻接矩阵中的值,表示图中的边权重。如果未提供,则结果图被视为未加权。
- create_using:cuGraph.Graph,可选(默认=cugraph.Graph)
指定要创建的图表类型。
参数:
例子:
>>> pdf = pd.read_csv(datasets_path / 'karate.csv', delimiter=' ', ... dtype={0:'int32', 1:'int32', 2:'float32'}, ... header=None) >>> M = scipy.sparse.coo_matrix((pdf[2],(pdf[0],pdf[1]))) >>> M = M.tocsr() >>> offsets = pd.Series(M.indptr) >>> indices = pd.Series(M.indices) >>> G = cugraph.from_adjlist(offsets, indices, None)
相关用法
- Python cugraph.structure.convert_matrix.from_edgelist用法及代码示例
- Python cugraph.structure.convert_matrix.from_pandas_edgelist用法及代码示例
- Python cugraph.structure.convert_matrix.from_cudf_edgelist用法及代码示例
- Python cugraph.structure.symmetrize.symmetrize_df用法及代码示例
- Python cugraph.structure.symmetrize.symmetrize_ddf用法及代码示例
- Python cugraph.structure.symmetrize.symmetrize用法及代码示例
- Python cugraph.sampling.random_walks.random_walks用法及代码示例
- Python cugraph.community.spectral_clustering.spectralBalancedCutClustering用法及代码示例
- Python cugraph.link_prediction.jaccard.jaccard用法及代码示例
- Python cugraph.link_prediction.wjaccard.jaccard_w用法及代码示例
- Python cugraph.community.ecg.ecg用法及代码示例
- Python cugraph.Graph.from_cudf_adjlist用法及代码示例
- Python cugraph.community.louvain.louvain用法及代码示例
- Python cugraph.tree.minimum_spanning_tree.maximum_spanning_tree用法及代码示例
- Python cugraph.centrality.betweenness_centrality.betweenness_centrality用法及代码示例
- Python cugraph.link_analysis.pagerank.pagerank用法及代码示例
- Python cugraph.dask.community.louvain.louvain用法及代码示例
- Python cugraph.traversal.bfs.bfs用法及代码示例
- Python cugraph.community.egonet.batched_ego_graphs用法及代码示例
- Python cugraph.tree.minimum_spanning_tree.minimum_spanning_tree用法及代码示例
注:本文由纯净天空筛选整理自rapids.ai大神的英文原创作品 cugraph.structure.convert_matrix.from_adjlist。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。