view env/lib/python3.9/site-packages/networkx/algorithms/ @ 0:4f3585e2f14b draft default tip

"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
author shellac
date Mon, 22 Mar 2021 18:12:50 +0000
line wrap: on
line source

import networkx as nx

def s_metric(G, normalized=True):
    """Returns the s-metric of graph.

    The s-metric is defined as the sum of the products deg(u)*deg(v)
    for every edge (u,v) in G. If norm is provided construct the
    s-max graph and compute it's s_metric, and return the normalized
    s value

    G    : graph
           The graph used to compute the s-metric.
    normalized : bool (optional)
           Normalize the value.

    s : float
        The s-metric of the graph.

    .. [1] Lun Li, David Alderson, John C. Doyle, and Walter Willinger,
           Towards a Theory of Scale-Free Graphs:
           Definition, Properties, and  Implications (Extended Version), 2005.
    if normalized:
        raise nx.NetworkXError("Normalization not implemented")
    #        Gmax = li_smax_graph(list(
    #        return s_metric(G,normalized=False)/s_metric(Gmax,normalized=False)
    #    else:
    return float(sum([ * for (u, v) in G.edges()]))