

def size(self, weight=None):
    "Return the number of edges.\n\n        Parameters\n        ----------\n        weight : string or None, optional (default=None)\n           The edge attribute that holds the numerical value used\n           as a weight.  If None, then each edge has weight 1.\n\n        Returns\n        -------\n        nedges : int\n            The number of edges or sum of edge weights in the graph.\n\n        See Also\n        --------\n        number_of_edges\n\n        Examples\n        --------\n        >>> G = nx.Graph()   # or DiGraph, MultiGraph, MultiDiGraph, etc\n        >>> G.add_path([0,1,2,3])\n        >>> G.size()\n        3\n\n        >>> G = nx.Graph()   # or DiGraph, MultiGraph, MultiDiGraph, etc\n        >>> G.add_edge('a','b',weight=2)\n        >>> G.add_edge('b','c',weight=4)\n        >>> G.size()\n        2\n        >>> G.size(weight='weight')\n        6.0\n        "
    s = (sum(self.degree(weight=weight).values()) / 2)
    if (weight is None):
        return int(s)
    else:
        return float(s)

dataset/ETHPy150Open networkx/networkx/networkx/classes/tests/timingclasses.py TimingGraph.size/original