(G, attr)
Calculates mean value of nodes attr for each edge.
Calculates mean value of nodes attr for each edge.
Calculates mean value of nodes attr for each edge .
def mean_nodes(G, attr):
    """
    Calculates mean value of nodes attr for each edge.
    """
    for u, v, k in G.edges(keys=True):
        mean = (G.nodes[u][attr] + G.nodes[v][attr]) / 2
        G[u][v][k][attr] = mean
def mean_nodes ( G , attr ) : for u , v , k in G . edges ( keys = True ) : mean = ( G . nodes [ u ] [ attr ] + G . nodes [ v ] [ attr ] ) / 2 G [ u ] [ v ] [ k ] [ attr ] = mean