#NEWLINE# def size( self , weight = None ) : #NEWLINE# #INDENT# "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 of 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        " #NEWLINE# s = ( sum ( self . degree ( weight = weight ) . values ( ) ) / 2 ) #NEWLINE# if ( weight is None ) : #NEWLINE# #INDENT# return int ( s ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return float ( s )