本文簡要介紹
networkx.algorithms.dag.dag_longest_path_length
的用法。用法:
dag_longest_path_length(G, weight='weight', default_weight=1)
返回 DAG 中的最長路徑長度
- G:NetworkX 有向圖
有向無環圖 (DAG)
- weight:字符串,可選
用於權重的邊數據鍵
- default_weight:整數,可選
沒有權重屬性的邊的權重
- int
最長路徑長度
- NetworkXNotImplemented
如果
G
未定向
參數:
返回:
拋出:
例子:
>>> DG = nx.DiGraph([(0, 1, {'cost':1}), (1, 2, {'cost':1}), (0, 2, {'cost':42})]) >>> list(nx.all_simple_paths(DG, 0, 2)) [[0, 1, 2], [0, 2]] >>> nx.dag_longest_path_length(DG) 2 >>> nx.dag_longest_path_length(DG, weight="cost") 42
相關用法
- Python NetworkX dag_longest_path用法及代碼示例
- Python NetworkX dag_to_branching用法及代碼示例
- Python NetworkX dedensify用法及代碼示例
- Python NetworkX draw_networkx_edge_labels用法及代碼示例
- Python NetworkX double_edge_swap用法及代碼示例
- Python NetworkX draw用法及代碼示例
- Python NetworkX descendants_at_distance用法及代碼示例
- Python NetworkX degree_assortativity_coefficient用法及代碼示例
- Python NetworkX dfs_successors用法及代碼示例
- Python NetworkX draw_planar用法及代碼示例
- Python NetworkX draw_circular用法及代碼示例
- Python NetworkX dijkstra_path_length用法及代碼示例
- Python NetworkX descendants用法及代碼示例
- Python NetworkX draw_spectral用法及代碼示例
- Python NetworkX degree_mixing_matrix用法及代碼示例
- Python NetworkX dijkstra_path用法及代碼示例
- Python NetworkX degrees用法及代碼示例
- Python NetworkX degree_pearson_correlation_coefficient用法及代碼示例
- Python NetworkX directed_configuration_model用法及代碼示例
- Python NetworkX draw_random用法及代碼示例
- Python NetworkX directed_joint_degree_graph用法及代碼示例
- Python NetworkX draw_shell用法及代碼示例
- Python NetworkX difference用法及代碼示例
- Python NetworkX disjoint_union用法及代碼示例
- Python NetworkX draw_networkx用法及代碼示例
注:本文由純淨天空篩選整理自networkx.org大神的英文原創作品 networkx.algorithms.dag.dag_longest_path_length。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。