用法:
cugraph.dask.traversal.sssp.sssp(graph, source)
計算從指定源到圖中所有頂點的最短路徑的距離和前驅。距離列將存儲從源到每個頂點的距離。前驅列將每個頂點的前驅存儲在最短路徑中。無法到達的頂點將具有無窮大的距離,由數據類型的最大值表示,並且前驅設置為 -1。源頂點的前驅也設置為 -1。輸入圖必須包含邊列表作為 dask-cudf 數據幀,每個 GPU 一個分區。
- graph:cugraph.DiGraph
cuGraph 圖說明符,應包含連接信息作為 dask cudf 邊列表數據幀。當前不支持無向圖。
- source:整數
指定源頂點
- df:dask_cudf.DataFrame
df[‘vertex’] 給出頂點 id
df[‘distance’] 給出到起始頂點的路徑距離
df[‘predecessor’] 給出遍曆中到達的頂點 id
參數:
返回:
例子:
>>> # import cugraph.dask as dcg >>> #... Init a DASK Cluster >>> # see https://docs.rapids.ai/api/cugraph/stable/dask-cugraph.html >>> # chunksize = dcg.get_chunksize(input_data_path) >>> # ddf = dask_cudf.read_csv(input_data_path, chunksize=chunksize...) >>> # dg = cugraph.Graph(directed=True) >>> # dg.from_dask_cudf_edgelist(ddf, 'src', 'dst') >>> # df = dcg.sssp(dg, 0)
相關用法
- Python cugraph.dask.traversal.bfs.bfs用法及代碼示例
- 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.sssp.sssp。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。