networkx.algorithms.isolate.number_of_isolates

number_of_isolates(G)[source]

Returns the number of isolates in the graph.

An isolate is a node with no neighbors (that is, with degree zero). For directed graphs, this means no in-neighbors and no out-neighbors.

Parameters

G (NetworkX graph)

Returns

The number of degree zero nodes in the graph G.

Return type

int