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