path_weight

path_weight(G, path, weight)[source]

Returns total cost associated with specified path and weight

Parameters
Ggraph

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: int

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

Raises
NetworkXNoPath

If the specified edge does not exist.