本文簡要介紹
networkx.algorithms.dag.ancestors 的用法。用法:
ancestors(G, source)返回在
G中具有到source的路徑的所有節點。- G:NetworkX 圖表
- source:
G中的節點
- set()
G中source的祖先
- NetworkXError
如果節點
source不在G中。
參數:
返回:
拋出:
例子:
>>> DG = nx.path_graph(5, create_using=nx.DiGraph) >>> sorted(list(nx.ancestors(DG, 2))) [0, 1]
相關用法
- Python NetworkX antichains用法及代碼示例
- Python NetworkX average_degree_connectivity用法及代碼示例
- Python NetworkX all_simple_paths用法及代碼示例
- Python NetworkX add_star用法及代碼示例
- Python NetworkX add_path用法及代碼示例
- Python NetworkX all_pairs_dijkstra_path用法及代碼示例
- Python NetworkX average_clustering用法及代碼示例
- Python NetworkX attr_matrix用法及代碼示例
- Python NetworkX arbitrary_element用法及代碼示例
- Python NetworkX average_neighbor_degree用法及代碼示例
- 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 average_shortest_path_length用法及代碼示例
- Python NetworkX all_topological_sorts用法及代碼示例
- Python NetworkX attribute_mixing_matrix用法及代碼示例
- Python NetworkX all_pairs_dijkstra用法及代碼示例
注:本文由純淨天空篩選整理自networkx.org大神的英文原創作品 networkx.algorithms.dag.ancestors。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。
