diff options
Diffstat (limited to 'networkx/algorithms')
-rw-r--r-- | networkx/algorithms/boundary.py | 4 | ||||
-rw-r--r-- | networkx/algorithms/cluster.py | 6 | ||||
-rw-r--r-- | networkx/algorithms/core.py | 2 | ||||
-rw-r--r-- | networkx/algorithms/cuts.py | 16 | ||||
-rw-r--r-- | networkx/algorithms/dag.py | 4 | ||||
-rw-r--r-- | networkx/algorithms/dominating.py | 2 | ||||
-rw-r--r-- | networkx/algorithms/isolate.py | 6 | ||||
-rw-r--r-- | networkx/algorithms/link_analysis/pagerank_alg.py | 2 | ||||
-rw-r--r-- | networkx/algorithms/reciprocity.py | 4 | ||||
-rw-r--r-- | networkx/algorithms/regular.py | 4 | ||||
-rw-r--r-- | networkx/algorithms/simple_paths.py | 2 | ||||
-rw-r--r-- | networkx/algorithms/smetric.py | 2 | ||||
-rw-r--r-- | networkx/algorithms/structuralholes.py | 2 | ||||
-rw-r--r-- | networkx/algorithms/tournament.py | 6 | ||||
-rw-r--r-- | networkx/algorithms/triads.py | 2 |
15 files changed, 32 insertions, 32 deletions
diff --git a/networkx/algorithms/boundary.py b/networkx/algorithms/boundary.py index c74f47e9..068ce645 100644 --- a/networkx/algorithms/boundary.py +++ b/networkx/algorithms/boundary.py @@ -14,7 +14,7 @@ from itertools import chain __all__ = ["edge_boundary", "node_boundary"] -@nx.dispatch("edge_boundary") +@nx.dispatch def edge_boundary(G, nbunch1, nbunch2=None, data=False, keys=False, default=None): """Returns the edge boundary of `nbunch1`. @@ -91,7 +91,7 @@ def edge_boundary(G, nbunch1, nbunch2=None, data=False, keys=False, default=None ) -@nx.dispatch("node_boundary") +@nx.dispatch() def node_boundary(G, nbunch1, nbunch2=None): """Returns the node boundary of `nbunch1`. 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. diff --git a/networkx/algorithms/core.py b/networkx/algorithms/core.py index ac339554..faf1f0d0 100644 --- a/networkx/algorithms/core.py +++ b/networkx/algorithms/core.py @@ -378,7 +378,7 @@ def k_corona(G, k, core_number=None): return _core_subgraph(G, func, k, core_number) -@nx.dispatch("k_truss") +@nx.dispatch @not_implemented_for("directed") @not_implemented_for("multigraph") def k_truss(G, k): diff --git a/networkx/algorithms/cuts.py b/networkx/algorithms/cuts.py index 271ff309..2b4794ef 100644 --- a/networkx/algorithms/cuts.py +++ b/networkx/algorithms/cuts.py @@ -21,7 +21,7 @@ __all__ = [ # TODO STILL NEED TO UPDATE ALL THE DOCUMENTATION! -@nx.dispatch("cut_size") +@nx.dispatch def cut_size(G, S, T=None, weight=None): """Returns the size of the cut between two sets of nodes. @@ -84,7 +84,7 @@ def cut_size(G, S, T=None, weight=None): return sum(weight for u, v, weight in edges) -@nx.dispatch("volume") +@nx.dispatch def volume(G, S, weight=None): """Returns the volume of a set of nodes. @@ -127,7 +127,7 @@ def volume(G, S, weight=None): return sum(d for v, d in degree(S, weight=weight)) -@nx.dispatch("normalized_cut_size") +@nx.dispatch def normalized_cut_size(G, S, T=None, weight=None): """Returns the normalized size of the cut between two sets of nodes. @@ -180,7 +180,7 @@ def normalized_cut_size(G, S, T=None, weight=None): return num_cut_edges * ((1 / volume_S) + (1 / volume_T)) -@nx.dispatch("conductance") +@nx.dispatch def conductance(G, S, T=None, weight=None): """Returns the conductance of two sets of nodes. @@ -228,7 +228,7 @@ def conductance(G, S, T=None, weight=None): return num_cut_edges / min(volume_S, volume_T) -@nx.dispatch("edge_expansion") +@nx.dispatch def edge_expansion(G, S, T=None, weight=None): """Returns the edge expansion between two node sets. @@ -275,7 +275,7 @@ def edge_expansion(G, S, T=None, weight=None): return num_cut_edges / min(len(S), len(T)) -@nx.dispatch("mixing_expansion") +@nx.dispatch def mixing_expansion(G, S, T=None, weight=None): """Returns the mixing expansion between two node sets. @@ -323,7 +323,7 @@ def mixing_expansion(G, S, T=None, weight=None): # TODO What is the generalization to two arguments, S and T? Does the # denominator become `min(len(S), len(T))`? -@nx.dispatch("node_expansion") +@nx.dispatch def node_expansion(G, S): """Returns the node expansion of the set `S`. @@ -363,7 +363,7 @@ def node_expansion(G, S): # TODO What is the generalization to two arguments, S and T? Does the # denominator become `min(len(S), len(T))`? -@nx.dispatch("boundary_expansion") +@nx.dispatch def boundary_expansion(G, S): """Returns the boundary expansion of the set `S`. diff --git a/networkx/algorithms/dag.py b/networkx/algorithms/dag.py index f7692d1f..381f079c 100644 --- a/networkx/algorithms/dag.py +++ b/networkx/algorithms/dag.py @@ -36,7 +36,7 @@ __all__ = [ chaini = chain.from_iterable -@nx.dispatch("descendants") +@nx.dispatch def descendants(G, source): """Returns all nodes reachable from `source` in `G`. @@ -73,7 +73,7 @@ def descendants(G, source): return {child for parent, child in nx.bfs_edges(G, source)} -@nx.dispatch("ancestors") +@nx.dispatch def ancestors(G, source): """Returns all nodes having a path to `source` in `G`. diff --git a/networkx/algorithms/dominating.py b/networkx/algorithms/dominating.py index 3f2da907..f80454b7 100644 --- a/networkx/algorithms/dominating.py +++ b/networkx/algorithms/dominating.py @@ -64,7 +64,7 @@ def dominating_set(G, start_with=None): return dominating_set -@nx.dispatch("is_dominating_set") +@nx.dispatch def is_dominating_set(G, nbunch): """Checks if `nbunch` is a dominating set for `G`. diff --git a/networkx/algorithms/isolate.py b/networkx/algorithms/isolate.py index d59a46c4..0a077177 100644 --- a/networkx/algorithms/isolate.py +++ b/networkx/algorithms/isolate.py @@ -6,7 +6,7 @@ import networkx as nx __all__ = ["is_isolate", "isolates", "number_of_isolates"] -@nx.dispatch("is_isolate") +@nx.dispatch def is_isolate(G, n): """Determines whether a node is an isolate. @@ -39,7 +39,7 @@ def is_isolate(G, n): return G.degree(n) == 0 -@nx.dispatch("isolates") +@nx.dispatch def isolates(G): """Iterator over isolates in the graph. @@ -85,7 +85,7 @@ def isolates(G): return (n for n, d in G.degree() if d == 0) -@nx.dispatch("number_of_isolates") +@nx.dispatch def number_of_isolates(G): """Returns the number of isolates in the graph. diff --git a/networkx/algorithms/link_analysis/pagerank_alg.py b/networkx/algorithms/link_analysis/pagerank_alg.py index 346fce03..03054322 100644 --- a/networkx/algorithms/link_analysis/pagerank_alg.py +++ b/networkx/algorithms/link_analysis/pagerank_alg.py @@ -6,7 +6,7 @@ import networkx as nx __all__ = ["pagerank", "google_matrix"] -@nx.dispatch("pagerank") +@nx.dispatch def pagerank( G, alpha=0.85, 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. diff --git a/networkx/algorithms/regular.py b/networkx/algorithms/regular.py index 89b98742..7c0b2709 100644 --- a/networkx/algorithms/regular.py +++ b/networkx/algorithms/regular.py @@ -5,7 +5,7 @@ from networkx.utils import not_implemented_for __all__ = ["is_regular", "is_k_regular", "k_factor"] -@nx.dispatch("is_regular") +@nx.dispatch def is_regular(G): """Determines whether the graph ``G`` is a regular graph. @@ -41,7 +41,7 @@ def is_regular(G): return in_regular and out_regular -@nx.dispatch("is_k_regular") +@nx.dispatch @not_implemented_for("directed") def is_k_regular(G, k): """Determines whether the graph ``G`` is a k-regular graph. diff --git a/networkx/algorithms/simple_paths.py b/networkx/algorithms/simple_paths.py index 0ddacabb..6284f961 100644 --- a/networkx/algorithms/simple_paths.py +++ b/networkx/algorithms/simple_paths.py @@ -13,7 +13,7 @@ __all__ = [ ] -@nx.dispatch("is_simple_path") +@nx.dispatch def is_simple_path(G, nodes): """Returns True if and only if `nodes` form a simple path in `G`. diff --git a/networkx/algorithms/smetric.py b/networkx/algorithms/smetric.py index a97bb8d9..a440aff1 100644 --- a/networkx/algorithms/smetric.py +++ b/networkx/algorithms/smetric.py @@ -3,7 +3,7 @@ import networkx as nx __all__ = ["s_metric"] -@nx.dispatch("s_metric") +@nx.dispatch def s_metric(G, normalized=True): """Returns the s-metric of graph. diff --git a/networkx/algorithms/structuralholes.py b/networkx/algorithms/structuralholes.py index 9762587e..417ba028 100644 --- a/networkx/algorithms/structuralholes.py +++ b/networkx/algorithms/structuralholes.py @@ -5,7 +5,7 @@ import networkx as nx __all__ = ["constraint", "local_constraint", "effective_size"] -@nx.dispatch("mutual_weight") +@nx.dispatch def mutual_weight(G, u, v, weight=None): """Returns the sum of the weights of the edge from `u` to `v` and the edge from `v` to `u` in `G`. diff --git a/networkx/algorithms/tournament.py b/networkx/algorithms/tournament.py index 60d09f31..a57c3592 100644 --- a/networkx/algorithms/tournament.py +++ b/networkx/algorithms/tournament.py @@ -61,7 +61,7 @@ def index_satisfying(iterable, condition): raise ValueError("iterable must be non-empty") from err -@nx.dispatch("is_tournament") +@nx.dispatch @not_implemented_for("undirected") @not_implemented_for("multigraph") def is_tournament(G): @@ -180,7 +180,7 @@ def random_tournament(n, seed=None): return nx.DiGraph(edges) -@nx.dispatch("score_sequence") +@nx.dispatch @not_implemented_for("undirected") @not_implemented_for("multigraph") def score_sequence(G): @@ -210,7 +210,7 @@ def score_sequence(G): return sorted(d for v, d in G.out_degree()) -@nx.dispatch("tournament_matrix") +@nx.dispatch @not_implemented_for("undirected") @not_implemented_for("multigraph") def tournament_matrix(G): diff --git a/networkx/algorithms/triads.py b/networkx/algorithms/triads.py index 0042f5c3..316643ea 100644 --- a/networkx/algorithms/triads.py +++ b/networkx/algorithms/triads.py @@ -275,7 +275,7 @@ def triadic_census(G, nodelist=None): return census -@nx.dispatch("is_triad") +@nx.dispatch() def is_triad(G): """Returns True if the graph G is a triad, else False. |