用法:
cugraph.structure.symmetrize.symmetrize_ddf(df, src_name, dst_name, weight_name=None)
獲取存儲在分布式 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:dask_cudf.DataFrame
包含 COO 的輸入 DataFrame 。列應包含源 ID、目標 ID 和與邊關聯的任何屬性。
- src_name:string
DataFrame 中包含源 ID 的列的名稱
- dst_name:string
DataFrame 中包含目標 ID 的列的名稱
- weight_name:字符串,可選(默認=無)
DataFrame 中包含權重的列的名稱
參數:
例子:
>>> # import cugraph.dask as dcg >>> # from cugraph.structure.symmetrize import symmetrize_ddf >>> # Init a DASK Cluster >>> # Download dataset from https://github.com/rapidsai/cugraph/datasets/.. >>> # chunksize = dcg.get_chunksize(datasets / 'karate.csv') >>> # ddf = dask_cudf.read_csv(datasets/'karate.csv', chunksize=chunksize, >>> # delimiter=' ', >>> # names=['src', 'dst', 'weight'], >>> # dtype=['int32', 'int32', 'float32']) >>> # sym_ddf = symmetrize_ddf(ddf, "src", "dst", "weight")
相關用法
- Python cugraph.structure.symmetrize.symmetrize_df用法及代碼示例
- 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_ddf。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。