def is_weighted(G):
    weighted = True
    for (u,v) in G.edges():
        weighted = weighted and ('weight' in G.edge[u][v])
        if not weighted:
            return weighted
    return weighted
Determine if a graph G is weighted
dataset/ETHPy150Open calliope-project/calliope/calliope/lib/nx_pylab.py/is_weighted