summaryrefslogtreecommitdiff
path: root/networkx/algorithms/cluster.py
diff options
context:
space:
mode:
authorJim Kitchen <jim22k@gmail.com>2022-10-11 15:24:14 -0500
committerMridul Seth <git@mriduls.com>2022-10-12 12:05:14 +0400
commitc2111a36841d5e43b6beae1fd667996d35646e30 (patch)
tree38fa5e1316ca45a9906169ceb7ac21bfc52a612e /networkx/algorithms/cluster.py
parent71434d674cf8ec6c3007dd41b78ee6f407e9b4eb (diff)
downloadnetworkx-nx-sparse.tar.gz
Allow dispatcher decorator without a namenx-sparse
- Name is taken from the decorated function - Raise error if backend doesn't implement a decorated function which is called - Check for duplicate names for dispatching algorithms
Diffstat (limited to 'networkx/algorithms/cluster.py')
-rw-r--r--networkx/algorithms/cluster.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/networkx/algorithms/cluster.py b/networkx/algorithms/cluster.py
index 159aba78..83596c94 100644
--- a/networkx/algorithms/cluster.py
+++ b/networkx/algorithms/cluster.py
@@ -220,7 +220,7 @@ def _directed_weighted_triangles_and_degree_iter(G, nodes=None, weight="weight")
yield (i, dtotal, dbidirectional, directed_triangles)
-@nx.dispatch("average_clustering")
+@nx.dispatch(name="average_clustering")
def average_clustering(G, nodes=None, weight=None, count_zeros=True):
r"""Compute the average clustering coefficient for the graph G.
@@ -280,7 +280,7 @@ def average_clustering(G, nodes=None, weight=None, count_zeros=True):
return sum(c) / len(c)
-@nx.dispatch("clustering")
+@nx.dispatch(name="clustering")
def clustering(G, nodes=None, weight=None):
r"""Compute the clustering coefficient for nodes.
@@ -433,7 +433,7 @@ def transitivity(G):
return 0 if triangles == 0 else triangles / contri
-@nx.dispatch("square_clustering")
+@nx.dispatch(name="square_clustering")
def square_clustering(G, nodes=None):
r"""Compute the squares clustering coefficient for nodes.