is_isolate#
- is_isolate(G, n)[source]#
确定一个节点是否为孤立节点。
*孤立节点*是指没有邻居的节点(即度数为零)。对于有向图,这意味着既没有入邻居也没有出邻居。
- Parameters:
- GNetworkX 图
- n节点
图
G中的一个节点。
- Returns:
- is_isolatebool
当且仅当
n没有邻居时为 True。
Examples
>>> G = nx.Graph() >>> G.add_edge(1, 2) >>> G.add_node(3) >>> nx.is_isolate(G, 2) False >>> nx.is_isolate(G, 3) True
Additional backends implement this function
graphblas : OpenMP-enabled sparse linear algebra backend.