Graph.
__len__
Returns the number of nodes. Use: ‘len(G)’.
Examples
>>> G = nx.path_graph(4) # or DiGraph, MultiGraph, MultiDiGraph, etc >>> len(G) 4