MCPcopy Create free account
hub / github.com/easy-graph/Easy-Graph / number_of_isolates

Function number_of_isolates

easygraph/functions/isolate.py:85–103  ·  view source on GitHub ↗

Returns the number of isolates in the graph. 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 : EasyGraph graph Returns ------- int The nu

(G)

Source from the content-addressed store, hash-verified

83
84
85def number_of_isolates(G):
86 """Returns the number of isolates in the graph.
87
88 An *isolate* is a node with no neighbors (that is, with degree
89 zero). For directed graphs, this means no in-neighbors and no
90 out-neighbors.
91
92 Parameters
93 ----------
94 G : EasyGraph graph
95
96 Returns
97 -------
98 int
99 The number of degree zero nodes in the graph `G`.
100
101 """
102 # TODO This can be parallelized.
103 return sum(1 for v in isolates(G))

Callers

nothing calls this directly

Calls 1

isolatesFunction · 0.85

Tested by

no test coverage detected