用法:
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。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。