Warning
This documents an unmaintained version of NetworkX. Please upgrade to a maintained version and see the current NetworkX documentation.
cost_of_flow¶

cost_of_flow
(G, flowDict, weight='weight')[source]¶ Compute the cost of the flow given by flowDict on graph G.
Note that this function does not check for the validity of the flow flowDict. This function will fail if the graph G and the flow don’t have the same edge set.
Parameters:  G (NetworkX graph) – DiGraph on which a minimum cost flow satisfying all demands is to be found.
 weight (string) – Edges of the graph G are expected to have an attribute weight that indicates the cost incurred by sending one unit of flow on that edge. If not present, the weight is considered to be 0. Default value: ‘weight’.
 flowDict (dictionary) – Dictionary of dictionaries keyed by nodes such that flowDict[u][v] is the flow edge (u, v).
Returns: cost – The total cost of the flow. This is given by the sum over all edges of the product of the edge’s flow and the edge’s weight.
Return type: Integer, float