8.1.9. networkx.algorithms.dag.dag_longest_path¶
-
networkx.algorithms.dag.dag_longest_path(G, weight='weight', default_weight=1)[source]¶ Returns the longest path in a DAG If G has edges with ‘weight’ attribute the edge data are used as weight values.
Parameters: G : NetworkX DiGraph
Graph
weight : string (default ‘weight’)
Edge data key to use for weight
default_weight : integer (default 1)
The weight of edges that do not have a weight attribute
Returns: path : list
Longest path
Raises: NetworkXNotImplemented
If G is not directed
See also