networkx.DiGraph.__len__
networkx.DiGraph.number_of_edges
Return the number of edges.
weighted : bool, optional
If True return the sum of the edge weights.
See also
Graph.number_of_edges
Examples
>>> G=nx.path_graph(4) >>> G.size() 3
>>> G=nx.Graph() >>> G.add_edge('a','b',2) >>> G.add_edge('b','c',4) >>> G.size() 2 >>> G.size(weighted=True) 6