summaryrefslogtreecommitdiff
path: root/networkx/algorithms/isolate.py
diff options
context:
space:
mode:
Diffstat (limited to 'networkx/algorithms/isolate.py')
-rw-r--r--networkx/algorithms/isolate.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/networkx/algorithms/isolate.py b/networkx/algorithms/isolate.py
index e81e7227..d59a46c4 100644
--- a/networkx/algorithms/isolate.py
+++ b/networkx/algorithms/isolate.py
@@ -1,10 +1,12 @@
"""
Functions for identifying isolate (degree zero) nodes.
"""
+import networkx as nx
__all__ = ["is_isolate", "isolates", "number_of_isolates"]
+@nx.dispatch("is_isolate")
def is_isolate(G, n):
"""Determines whether a node is an isolate.
@@ -37,6 +39,7 @@ def is_isolate(G, n):
return G.degree(n) == 0
+@nx.dispatch("isolates")
def isolates(G):
"""Iterator over isolates in the graph.
@@ -82,6 +85,7 @@ def isolates(G):
return (n for n, d in G.degree() if d == 0)
+@nx.dispatch("number_of_isolates")
def number_of_isolates(G):
"""Returns the number of isolates in the graph.