用法:
cugraph.structure.symmetrize.symmetrize_df(df, src_name, dst_name, multi=False, symmetrize=True)
獲取存儲在 DataFrame 中的 COO,以及源列和目標列的列名,並使用使圖形對稱的相同列名創建一個新的 DataFrame ,以便所有邊都出現在兩個方向上。請注意,如果 DataFrame 中存在其他列(例如邊權重),其他列也將被複製。也就是說,如果 (u,v,data) 表示輸入數據中的源值 (u)、目標值 (v) 和一些其他列 (data),那麽輸出數據將同時包含 (u,v, data) 和 (v,u,data) 與匹配的數據。如果 (u,v,data1) 和 (v,u,data2) 存在於 data1 != data2 的輸入數據中,則此代碼將任意選擇要保留的較小數據元素,如果不需要,則調用者應更正調用對稱之前的數據。
- df:cudf.DataFrame
包含 COO 的輸入 DataFrame 。列應包含源 ID、目標 ID 和與邊關聯的任何屬性。
- src_name:string
DataFrame 中包含源 ID 的列的名稱
- dst_name:string
DataFrame 中包含目標 ID 的列的名稱
- multi:布爾,可選(默認=假)
如果圖形是 Multi(Di)Graph,則設置為 True。這允許多個邊而不是丟棄它們。
- symmetrize:布爾,可選(默認=真)
默認為 True 以執行對稱化。如果為 False,則僅刪除重複的邊。
參數:
例子:
>>> from cugraph.structure.symmetrize import symmetrize_df >>> # Download dataset from https://github.com/rapidsai/cugraph/datasets/.. >>> M = cudf.read_csv(datasets_path / 'karate.csv', delimiter=' ', ... dtype=['int32', 'int32', 'float32'], header=None) >>> sym_df = symmetrize_df(M, '0', '1')
相關用法
- Python cugraph.structure.symmetrize.symmetrize_ddf用法及代碼示例
- Python cugraph.structure.symmetrize.symmetrize用法及代碼示例
- 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_df。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。