本文簡要介紹
networkx.algorithms.approximation.clustering_coefficient.average_clustering
的用法。用法:
average_clustering(G, trials=1000, seed=None)
估計 G 的平均聚類係數。
G
中每個節點的局部聚類是實際存在於其鄰域內所有可能三角形中的三角形的分數。圖G
的平均聚類係數是局部聚類的平均值。該函數通過重複
n
次(在trials
中定義)以下實驗來找到 G 的近似平均聚類係數:隨機選擇一個節點,隨機選擇其兩個鄰居,並檢查它們是否相連。近似係數是在多次試驗中找到的三角形的分數 [1]。- G:NetworkX 圖
- trials:整數
要執行的試驗次數(默認 1000)。
- seed:整數、random_state 或無(默認)
隨機數生成狀態的指示符。請參閱隨機性。
- c:浮點數
近似的平均聚類係數。
參數:
返回:
參考:
- 1
Schank, Thomas, and Dorothea Wagner. Approximating clustering coefficient and transitivity. Universität Karlsruhe, Fakultät für Informatik, 2004. https://doi.org/10.5445/IR/1000001239
例子:
>>> from networkx.algorithms import approximation >>> G = nx.erdos_renyi_graph(10, 0.2, seed=10) >>> approximation.average_clustering(G, trials=1000, seed=10) 0.214
相關用法
- Python NetworkX average_clustering用法及代碼示例
- Python NetworkX average_degree_connectivity用法及代碼示例
- Python NetworkX average_neighbor_degree用法及代碼示例
- Python NetworkX average_shortest_path_length用法及代碼示例
- Python NetworkX all_simple_paths用法及代碼示例
- Python NetworkX add_star用法及代碼示例
- Python NetworkX add_path用法及代碼示例
- Python NetworkX all_pairs_dijkstra_path用法及代碼示例
- Python NetworkX attr_matrix用法及代碼示例
- Python NetworkX arbitrary_element用法及代碼示例
- Python NetworkX all_pairs_shortest_path用法及代碼示例
- Python NetworkX attribute_mixing_dict用法及代碼示例
- Python NetworkX all_node_cuts用法及代碼示例
- Python NetworkX attr_sparse_matrix用法及代碼示例
- Python NetworkX articulation_points用法及代碼示例
- Python NetworkX asadpour_atsp用法及代碼示例
- Python NetworkX all_shortest_paths用法及代碼示例
- Python NetworkX all_simple_edge_paths用法及代碼示例
- Python NetworkX adjacency_graph用法及代碼示例
- Python NetworkX astar_path用法及代碼示例
- Python NetworkX all_pairs_bellman_ford_path用法及代碼示例
- Python NetworkX ancestors用法及代碼示例
- Python NetworkX all_topological_sorts用法及代碼示例
- Python NetworkX attribute_mixing_matrix用法及代碼示例
- Python NetworkX all_pairs_dijkstra用法及代碼示例
注:本文由純淨天空篩選整理自networkx.org大神的英文原創作品 networkx.algorithms.approximation.clustering_coefficient.average_clustering。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。