Determines whether a node is an isolate. 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 ---------- G : NetworkX graph n : node A node in `G`. Returns
(G, n)
| 9 | |
| 10 | @nx._dispatchable |
| 11 | def is_isolate(G, n): |
| 12 | """Determines whether a node is an isolate. |
| 13 | |
| 14 | An *isolate* is a node with no neighbors (that is, with degree |
| 15 | zero). For directed graphs, this means no in-neighbors and no |
| 16 | out-neighbors. |
| 17 | |
| 18 | Parameters |
| 19 | ---------- |
| 20 | G : NetworkX graph |
| 21 | |
| 22 | n : node |
| 23 | A node in `G`. |
| 24 | |
| 25 | Returns |
| 26 | ------- |
| 27 | is_isolate : bool |
| 28 | True if and only if `n` has no neighbors. |
| 29 | |
| 30 | Examples |
| 31 | -------- |
| 32 | >>> G = nx.Graph() |
| 33 | >>> G.add_edge(1, 2) |
| 34 | >>> G.add_node(3) |
| 35 | >>> nx.is_isolate(G, 2) |
| 36 | False |
| 37 | >>> nx.is_isolate(G, 3) |
| 38 | True |
| 39 | """ |
| 40 | return G.degree(n) == 0 |
| 41 | |
| 42 | |
| 43 | @nx._dispatchable |
nothing calls this directly
no test coverage detected
searching dependent graphs…