NetworkX

Previous topic

networkx.MultiGraph.__len__

Next topic

networkx.MultiGraph.number_of_edges

Quick search

networkx.MultiGraph.size

MultiGraph.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