用法:
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。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。