用法:
cugraph.dask.centrality.katz_centrality.katz_centrality(input_graph, alpha=None, beta=None, max_iter=100, tol=1e-05, nstart=None, normalized=True)
計算圖 G 的節點的 Katz 中心性。
- input_graph:cuGraph.Graph
帶有連接信息的 cuGraph 圖說明符。該圖可以包含有向邊 (DiGraph) 或無向邊 (Graph)。
- alpha:浮點數,可選(默認=無)
衰減因子。如果未指定 alpha,則它在內部計算為 1/(degree_max),其中 degree_max 是最大出度。
- NOTE
收斂的最大可接受值 alpha_max = 1/(lambda_max) 其中 lambda_max 是圖的最大特征值。由於圖表的lambda_max 始終小於或等於degree_max,因此alpha_max 將始終大於或等於 (1/degree_max)。因此,將 alpha 設置為 (1/degree_max) 將保證它永遠不會超過 alpha_max,從而滿足收斂的要求。
- beta:None
權重標量 - 目前不支持
- max_iter:int,可選(默認=100)
返回答案之前的最大迭代次數。這可用於限製執行時間並在求解器達到收斂容差之前提前退出。如果此值小於或等於 0,cuGraph 將使用默認值,即 100。
- tol:浮點數,可選(默認=1.0e-5)
設置容差的近似值,這個參數應該是一個小的幅度值。容差越低,近似值越好。如果該值為 0.0f,cuGraph 將使用默認值 1.0e-6。由於數值舍入,容差設置太小會導致不收斂。通常 1e-2 和 1e-6 之間的值是可以接受的。
- nstart:dask_cudf.Dataframe,可選(默認=無)
包含 katz 中心性的初始猜測的 GPU 數據幀
- nstart[‘vertex’]:dask_cudf.係列
包含頂點標識符
- nstart[‘values’]:dask_cudf.係列
包含頂點的 katz 中心值
- normalized:布爾,可選(默認=真)
如果 True 歸一化生成的 katz 中心性值
- katz_centrality:dask_cudf.DataFrame
GPU 數據幀包含兩個大小為 V 的dask_cudf.Series:頂點標識符和相應的 katz 中心值。
- ddf[‘vertex’]:dask_cudf.係列
包含頂點標識符
- ddf[‘katz_centrality’]:dask_cudf.係列
包含頂點的 katz 中心性
參數:
返回:
例子:
>>> # 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') >>> # pr = dcg.katz_centrality(dg)
相關用法
- Python cugraph.dask.community.louvain.louvain用法及代碼示例
- Python cugraph.dask.common.read_utils.get_chunksize用法及代碼示例
- 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.centrality.katz_centrality.katz_centrality。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。