NetworkX

Previous topic

isolates

Next topic

isolates

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 : bool

True if n has no neighbors, False otherwise.

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