def make_flow_labels(graph, flow, capac):
    """Generate arc labels for a flow in a graph with capacities.

    :param graph: adjacency list or adjacency dictionary
    :param flow:  flow matrix or adjacency dictionary
    :param capac: capacity matrix or adjacency dictionary
    :returns: listdic graph representation, with the arc label strings
    """
    V = range(len(graph))
    arc_label = [{v:"" for v in graph[u]} for u in V]
    for u in V:
        for v in graph[u]:
            if flow[u][v] >= 0:
                arc_label[u][v] = "%s/%s" % (flow[u][v], capac[u][v])
            else:
                arc_label[u][v] = None   # do not show negative flow arcs
    return arc_label
def make_flow_labels ( graph , flow , capac ) : V = range ( len ( graph ) ) arc_label = [ { v : "" for v in graph [ u ] } for u in V ] for u in V : for v in graph [ u ] : if flow [ u ] [ v ] >= 0 : arc_label [ u ] [ v ] = "%s/%s" % ( flow [ u ] [ v ] , capac [ u ] [ v ] ) else : arc_label [ u ] [ v ] = None return arc_label
Generate arc labels for a flow in a graph with capacities.

    :param graph: adjacency list or adjacency dictionary
    :param flow:  flow matrix or adjacency dictionary
    :param capac: capacity matrix or adjacency dictionary
    :returns: listdic graph representation, with the arc label strings