NetworkX

Previous topic

networkx.LabeledDiGraph.__len__

Next topic

networkx.LabeledDiGraph.number_of_edges

Quick search

networkx.LabeledDiGraph.size

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