#

Note

This documents the development version of NetworkX. Documentation for the current release can be found here.

#

networkx.classes.function.path_weight

path_weight(G, path, weight)[source]

Returns total cost associated with specified path and weight

Parameters
  • G (graph) – A NetworkX graph.

  • path (list) – A list of node labels which defines the path to traverse

  • weight (string) – A string indicating which edge attribute to use for path cost

Returns

cost – A integer representing the total cost with respect to the specified weight of the specified path

Return type

int

Raises

NetworkXNoPath – If the specified edge does not exist.