def get_node_flow(flow_net, node):
    """
    Returns the sum of the flow into minus the sum of the flow out from the
    node.

    In a maximum flow network, this function returns 0 for all nodes except
    for the source (wich returns -max_flow) and drain (wich returns max_flow).
    """
    flow = 0
    n = len(flow_net)
    for i in range(n):
        flow += flow_net[i][node]
        flow -= flow_net[node][i]
    return flow