用法:
cugraph.dask.traversal.bfs.bfs(graph, start, depth_limit=None, return_distances=True)
查找圖的廣度優先遍曆的距離和前輩。輸入圖必須包含邊列表作為 dask-cudf 數據幀,每個 GPU 一個分區。
- graph:cugraph.DiGraph
cuGraph 圖說明符,應包含連接信息作為 dask cudf 邊列表數據幀(該算法不使用邊權重)。當前不支持無向圖。
- start:整數
指定breadth-first搜索的起始頂點;此函數迭代從該節點可到達的組件中的邊。
- depth_limit:整數或無,可選(默認=無)
限製搜索的深度
- return_distances:布爾,可選(默認=真)
指示是否應返回距離
- df:dask_cudf.DataFrame
df[‘vertex’] 給出頂點 id
df[‘distance’] 給出到起始頂點的路徑距離(僅當 return_distances 為 True 時)
df[‘predecessor’] 給出遍曆中到達的頂點
參數:
返回:
例子:
>>> # import cugraph.dask as dcg >>> # ... Init a DASK Cluster >>> # see https://docs.rapids.ai/api/cugraph/stable/dask-cugraph.html >>> # Download dataset from https://github.com/rapidsai/cugraph/datasets/.. >>> # chunksize = dcg.get_chunksize(datasets_path / "karate.csv") >>> # ddf = dask_cudf.read_csv(input_data_path, chunksize=chunksize) >>> # dg = cugraph.Graph(directed=True) >>> # dg.from_dask_cudf_edgelist(ddf, source='src', destination='dst', >>> # edge_attr='value') >>> # df = dcg.bfs(dg, 0)
相關用法
- Python cugraph.dask.traversal.sssp.sssp用法及代碼示例
- Python cugraph.dask.community.louvain.louvain用法及代碼示例
- Python cugraph.dask.common.read_utils.get_chunksize用法及代碼示例
- Python cugraph.dask.centrality.katz_centrality.katz_centrality用法及代碼示例
- Python cugraph.dask.link_analysis.pagerank.pagerank用法及代碼示例
- 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.traversal.bfs.bfs用法及代碼示例
- Python cugraph.community.egonet.batched_ego_graphs用法及代碼示例
- Python cugraph.tree.minimum_spanning_tree.minimum_spanning_tree用法及代碼示例
- Python cugraph.Graph.from_cudf_edgelist用法及代碼示例
- Python cugraph.centrality.betweenness_centrality.edge_betweenness_centrality用法及代碼示例
- Python cugraph.link_prediction.woverlap.overlap_w用法及代碼示例
注:本文由純淨天空篩選整理自rapids.ai大神的英文原創作品 cugraph.dask.traversal.bfs.bfs。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。