MCPcopy
hub / github.com/networkx/networkx / is_isolate

Function is_isolate

networkx/algorithms/isolate.py:11–40  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

9
10@nx._dispatchable
11def 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

Callers

nothing calls this directly

Calls 1

degreeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…