to_graph#

module wntr.network.io

to_graph(wn, node_weight=None, link_weight=None, modify_direction=False)[source]#

Convert a WaterNetworkModel into a networkx MultiDiGraph

Parameters:
  • node_weight (dict or pandas Series (optional)) – Node weights

  • link_weight (dict or pandas Series (optional)) – Link weights.

  • modify_direction (bool (optional)) – If True, than if the link weight is negative, the link start and end node are switched and the abs(weight) is assigned to the link (this is useful when weighting graphs by flowrate). If False, link direction and weight are not changed.

Return type:

networkx MultiDiGraph