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)
| 83 | |
| 84 | |
| 85 | def 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)) |
nothing calls this directly
no test coverage detected