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:
- GNetworkX graph
- Returns:
- int
The number of degree zero nodes in the graph
G
.
Additional backends implement this function
cugraph : GPU-accelerated backend.
graphblas : OpenMP-enabled sparse linear algebra backend.
- parallelA networkx backend that uses joblib to run graph algorithms in parallel. Find the nx-parallel’s configuration guide here
The parallel computation is implemented by dividing the list of isolated nodes into chunks and then finding the length of each chunk in parallel and then adding all the lengths at the end.
- Additional parameters:
- get_chunksstr, function (default = “chunks”)
A function that takes in a list of all the isolated nodes as input and returns an iterable
isolate_chunks
. The default chunking is done by slicing theisolates
inton_jobs
number of chunks.
[Source]