is_isolate

is_isolate(G, n)[source]

Determine of node n is an isolate (degree zero).

Parameters:
  • G (graph) – A networkx graph
  • n (node) – A node in G
Returns:

isolate – True if n has no neighbors, False otherwise.

Return type:

bool

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