NetworkX

Previous topic

networkx.MultiDiGraph.__len__

Next topic

networkx.MultiDiGraph.number_of_edges

Quick search

networkx.MultiDiGraph.size

MultiDiGraph.size(weighted=False)

Return the number of edges.

Parameters:

weighted : bool, optional

If True return the sum of the edge weights.

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