用法:
cugraph.structure.symmetrize.symmetrize(source_col, dest_col, value_col=None, multi=False, symmetrize=True)
獲取一組 COO 源目標對以及存儲在單個 GPU 中的相關值或分布式創建一個新的源目標對 COO 集以及所有邊都存在於兩個方向上的值。
此調用的返回將是存儲為兩個 cudf 係列或 dask_cudf.Series 的 COO - 對稱源列和對稱目標列,以及包含相關值的可選 cudf 係列(僅當傳入值時)。
- source_col:cudf.Series 或 dask_cudf.Series
這個 cudf.Series 包裝了大小為 E 的 gdf_column(E:邊數)。 gdf 列包含每條邊的源索引。源索引必須是整數類型。
- dest_col:cudf.Series 或 dask_cudf.Series
這個 cudf.Series 包裝了大小為 E 的 gdf_column(E:邊數)。 gdf 列包含每條邊的目標索引。目標索引必須是整數類型。
- value_col:cudf.Series 或dask_cudf.Series,可選(默認=無)
這個 cudf.Series 包裝了大小為 E 的 gdf_column(E:邊數)。 gdf 列包含與該邊相關的值。對於這個函數,值可以是任何類型,它們不被檢查,隻是被複製。
- multi:布爾,可選(默認=假)
如果圖形是 Multi(Di)Graph,則設置為 True。這允許多個邊而不是丟棄它們。
- symmetrize:布爾型,可選
默認為 True 以執行對稱化。如果為 False,則僅刪除重複的邊。
參數:
例子:
>>> from cugraph.structure.symmetrize import symmetrize >>> # Download dataset from https://github.com/rapidsai/cugraph/datasets/.. >>> M = cudf.read_csv(datasets_path / 'karate.csv', delimiter=' ', ... dtype=['int32', 'int32', 'float32'], header=None) >>> sources = cudf.Series(M['0']) >>> destinations = cudf.Series(M['1']) >>> values = cudf.Series(M['2']) >>> src, dst, val = symmetrize(sources, destinations, values)
相關用法
- Python cugraph.structure.symmetrize.symmetrize_df用法及代碼示例
- Python cugraph.structure.symmetrize.symmetrize_ddf用法及代碼示例
- Python cugraph.structure.convert_matrix.from_edgelist用法及代碼示例
- Python cugraph.structure.convert_matrix.from_pandas_edgelist用法及代碼示例
- Python cugraph.structure.convert_matrix.from_adjlist用法及代碼示例
- Python cugraph.structure.convert_matrix.from_cudf_edgelist用法及代碼示例
- 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.symmetrize.symmetrize。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。