From c2111a36841d5e43b6beae1fd667996d35646e30 Mon Sep 17 00:00:00 2001 From: Jim Kitchen Date: Tue, 11 Oct 2022 15:24:14 -0500 Subject: Allow dispatcher decorator without a name - 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 --- networkx/algorithms/reciprocity.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'networkx/algorithms/reciprocity.py') diff --git a/networkx/algorithms/reciprocity.py b/networkx/algorithms/reciprocity.py index 9819de8b..660d922f 100644 --- a/networkx/algorithms/reciprocity.py +++ b/networkx/algorithms/reciprocity.py @@ -7,7 +7,7 @@ from ..utils import not_implemented_for __all__ = ["reciprocity", "overall_reciprocity"] -@nx.dispatch("reciprocity") +@nx.dispatch @not_implemented_for("undirected", "multigraph") def reciprocity(G, nodes=None): r"""Compute the reciprocity in a directed graph. @@ -75,7 +75,7 @@ def _reciprocity_iter(G, nodes): yield (node, reciprocity) -@nx.dispatch("overall_reciprocity") +@nx.dispatch @not_implemented_for("undirected", "multigraph") def overall_reciprocity(G): """Compute the reciprocity for the whole graph. -- cgit v1.2.1