entropy#

module wntr.metrics.hydraulic

entropy(G, sources=None, sinks=None)[source]#

Compute entropy, equations from [2].

Entropy is a measure of uncertainty in a random variable. In a water distribution network model, the random variable is flow in the pipes and entropy can be used to measure alternate flow paths when a network component fails. A network that carries maximum entropy flow is considered reliable with multiple alternate paths.

Parameters:
  • G (NetworkX or WNTR graph) – Entropy is computed using a directed graph based on pipe flow direction. The ‘weight’ of each link is equal to the flow rate.

  • sources (list of strings, optional (default = all reservoirs)) – List of node names to use as sources.

  • sinks (list of strings, optional (default = all nodes)) – List of node names to use as sinks.

Returns:

  • A pandas Series that contains entropy for each node

  • System entropy (float)

Return type:

A tuple which includes