code: def edmonds_karp(graph, capacity, source, target):
      
      add_reverse_arcs(graph, capacity)
      V = range(len(graph))
      flow = [[0 for v in V] for u in V]
      while True:
          augm_path, delta = _augment(graph, capacity, flow, source, target)
          if delta == 0:
              break
          v = target                    # go back to source
          while v != source:
              u = augm_path[v]          # augment flow
              flow[u][v] += delta
              flow[v][u] -= delta
              v = u
      return (flow, sum(flow[source]))
docs: Maximum flow by Edmonds-Karp
  
      :param graph: directed graph in listlist or listdict format
      :param capacity: in matrix format or same listdict graph
      :param int source: vertex
      :param int target: vertex
      :returns: flow matrix, flow value
      :complexity: :math:`O(|V|*|E|^2)`