用法:
cugraph.dask.community.louvain.louvain(input_graph, max_iter=100, resolution=1.0)
在多個 GPU 上使用 Louvain 方法計算輸入圖的模塊化優化分區
它使用如下所述的 Louvain 方法:
VD Blondel,J-L Guillaume、R Lambiotte 和 E Lefebvre:在大型網絡中快速展開社區層次結構,J Stat Mech P10008 (2008),http://arxiv.org/abs/0803.0476
- input_graph:cugraph.Graph 或 NetworkX Graph
圖說明符應包含連接信息和權重。如果不存在鄰接列表,則將計算該鄰接列表。
- max_iter:整數,可選(默認=100)
這控製了 Louvain 算法的最大級別/迭代次數。當指定時,算法將在不超過指定的迭代次數後終止。當算法以這種方式提前終止時,不會發生錯誤。
- resolution: float/double, optional (default=1.0):
在模塊化公式中稱為 gamma,這會改變社區的規模。更高的分辨率會導致更多的小型社區,更低的分辨率會導致更少的大型社區。默認為 1。
- parts:cudf.DataFrame
大小為 V 的 GPU 數據幀包含兩列,即頂點 id 和分配給它的分區 id。
- df[‘vertex’]:cudf.Series
包含頂點標識符
- df[‘partition’]:cudf.Series
包含分配給頂點的分區
- modularity_score:浮點數
一個浮點數,包含分區的全局模塊化分數。
參數:
返回:
例子:
>>> # 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') >>> # parts, modularity_score = dcg.louvain(dg)
相關用法
- Python cugraph.dask.common.read_utils.get_chunksize用法及代碼示例
- Python cugraph.dask.centrality.katz_centrality.katz_centrality用法及代碼示例
- Python cugraph.dask.traversal.bfs.bfs用法及代碼示例
- Python cugraph.dask.traversal.sssp.sssp用法及代碼示例
- 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.community.louvain.louvain。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。