number_of_isolates#

number_of_isolates(G)[source]#

返回图中的孤立节点数量。

*孤立节点*是指没有邻居的节点(即度数为零)。对于有向图,这意味着既没有入邻居也没有出邻居。

Parameters:
GNetworkX 图
Returns:
int

G 中度数为零的节点数量。


Additional backends implement this function

graphblas : OpenMP-enabled sparse linear algebra backend.

parallelParallel backend for NetworkX algorithms

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 the isolates into n chunks, where n is the total number of CPU cores available.

[Source]