diff --git a/stubs/networkx/networkx/algorithms/__init__.pyi b/stubs/networkx/networkx/algorithms/__init__.pyi index 8d47145126d6..57141f108e16 100644 --- a/stubs/networkx/networkx/algorithms/__init__.pyi +++ b/stubs/networkx/networkx/algorithms/__init__.pyi @@ -30,6 +30,7 @@ from networkx.algorithms.bipartite import ( ) from networkx.algorithms.boundary import * from networkx.algorithms.bridges import * +from networkx.algorithms.broadcasting import * from networkx.algorithms.centrality import * from networkx.algorithms.chains import * from networkx.algorithms.chordal import * @@ -116,6 +117,7 @@ from networkx.algorithms.sparsifiers import * from networkx.algorithms.structuralholes import * from networkx.algorithms.summarization import * from networkx.algorithms.swap import * +from networkx.algorithms.time_dependent import * from networkx.algorithms.traversal import * from networkx.algorithms.tree.branchings import ( ArborescenceIterator as ArborescenceIterator, @@ -132,4 +134,5 @@ from networkx.algorithms.tree.recognition import * from networkx.algorithms.triads import * from networkx.algorithms.vitality import * from networkx.algorithms.voronoi import * +from networkx.algorithms.walks import * from networkx.algorithms.wiener import * diff --git a/stubs/networkx/networkx/algorithms/approximation/clique.pyi b/stubs/networkx/networkx/algorithms/approximation/clique.pyi index 886ec93f7c02..99c86b3a1c87 100644 --- a/stubs/networkx/networkx/algorithms/approximation/clique.pyi +++ b/stubs/networkx/networkx/algorithms/approximation/clique.pyi @@ -1,10 +1,11 @@ +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def maximum_independent_set(G): ... +def maximum_independent_set(G: Graph[_Node]): ... @_dispatchable -def max_clique(G): ... +def max_clique(G: Graph[_Node]): ... @_dispatchable -def clique_removal(G): ... +def clique_removal(G: Graph[_Node]): ... @_dispatchable -def large_clique_size(G): ... +def large_clique_size(G: Graph[_Node]): ... diff --git a/stubs/networkx/networkx/algorithms/approximation/clustering_coefficient.pyi b/stubs/networkx/networkx/algorithms/approximation/clustering_coefficient.pyi index b18a813d1192..b02ea8144d50 100644 --- a/stubs/networkx/networkx/algorithms/approximation/clustering_coefficient.pyi +++ b/stubs/networkx/networkx/algorithms/approximation/clustering_coefficient.pyi @@ -1,6 +1,6 @@ -from _typeshed import Incomplete - +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable +from numpy.random import RandomState @_dispatchable -def average_clustering(G, trials: int = 1000, seed: Incomplete | None = None): ... +def average_clustering(G: Graph[_Node], trials: int = 1000, seed: int | RandomState | None = None): ... diff --git a/stubs/networkx/networkx/algorithms/approximation/connectivity.pyi b/stubs/networkx/networkx/algorithms/approximation/connectivity.pyi index 8a431a9acb00..b20466e208e5 100644 --- a/stubs/networkx/networkx/algorithms/approximation/connectivity.pyi +++ b/stubs/networkx/networkx/algorithms/approximation/connectivity.pyi @@ -1,10 +1,12 @@ from _typeshed import Incomplete +from collections.abc import Iterable +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def local_node_connectivity(G, source, target, cutoff: Incomplete | None = None): ... +def local_node_connectivity(G: Graph[_Node], source: _Node, target: _Node, cutoff: int | None = None): ... @_dispatchable -def node_connectivity(G, s: Incomplete | None = None, t: Incomplete | None = None): ... +def node_connectivity(G: Graph[_Node], s: _Node | None = None, t: _Node | None = None): ... @_dispatchable -def all_pairs_node_connectivity(G, nbunch: Incomplete | None = None, cutoff: Incomplete | None = None): ... +def all_pairs_node_connectivity(G: Graph[_Node], nbunch: Iterable[Incomplete] | None = None, cutoff: int | None = None): ... diff --git a/stubs/networkx/networkx/algorithms/approximation/distance_measures.pyi b/stubs/networkx/networkx/algorithms/approximation/distance_measures.pyi index 75b45b52003e..08662306c401 100644 --- a/stubs/networkx/networkx/algorithms/approximation/distance_measures.pyi +++ b/stubs/networkx/networkx/algorithms/approximation/distance_measures.pyi @@ -1,6 +1,6 @@ -from _typeshed import Incomplete - +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable +from numpy.random import RandomState @_dispatchable -def diameter(G, seed: Incomplete | None = None): ... +def diameter(G: Graph[_Node], seed: int | RandomState | None = None): ... diff --git a/stubs/networkx/networkx/algorithms/approximation/dominating_set.pyi b/stubs/networkx/networkx/algorithms/approximation/dominating_set.pyi index b08dc451db96..0eda30759ea1 100644 --- a/stubs/networkx/networkx/algorithms/approximation/dominating_set.pyi +++ b/stubs/networkx/networkx/algorithms/approximation/dominating_set.pyi @@ -1,8 +1,7 @@ -from _typeshed import Incomplete - +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def min_weighted_dominating_set(G, weight: Incomplete | None = None): ... +def min_weighted_dominating_set(G: Graph[_Node], weight: str | None = None): ... @_dispatchable -def min_edge_dominating_set(G): ... +def min_edge_dominating_set(G: Graph[_Node]): ... diff --git a/stubs/networkx/networkx/algorithms/approximation/kcomponents.pyi b/stubs/networkx/networkx/algorithms/approximation/kcomponents.pyi index 46d89ff537d3..27bdc9efc106 100644 --- a/stubs/networkx/networkx/algorithms/approximation/kcomponents.pyi +++ b/stubs/networkx/networkx/algorithms/approximation/kcomponents.pyi @@ -1,4 +1,5 @@ +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def k_components(G, min_density: float = 0.95): ... +def k_components(G: Graph[_Node], min_density: float = 0.95): ... diff --git a/stubs/networkx/networkx/algorithms/approximation/matching.pyi b/stubs/networkx/networkx/algorithms/approximation/matching.pyi index 310ef31b91bf..798b8f0ac6be 100644 --- a/stubs/networkx/networkx/algorithms/approximation/matching.pyi +++ b/stubs/networkx/networkx/algorithms/approximation/matching.pyi @@ -1,4 +1,5 @@ +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def min_maximal_matching(G): ... +def min_maximal_matching(G: Graph[_Node]): ... diff --git a/stubs/networkx/networkx/algorithms/approximation/maxcut.pyi b/stubs/networkx/networkx/algorithms/approximation/maxcut.pyi index 760c114b4a41..e84b601c8f21 100644 --- a/stubs/networkx/networkx/algorithms/approximation/maxcut.pyi +++ b/stubs/networkx/networkx/algorithms/approximation/maxcut.pyi @@ -1,8 +1,14 @@ from _typeshed import Incomplete +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable +from numpy.random import RandomState @_dispatchable -def randomized_partitioning(G, seed: Incomplete | None = None, p: float = 0.5, weight: Incomplete | None = None): ... +def randomized_partitioning( + G: Graph[_Node], seed: int | RandomState | None = None, p: float = 0.5, weight: str | None = None +): ... @_dispatchable -def one_exchange(G, initial_cut: Incomplete | None = None, seed: Incomplete | None = None, weight: Incomplete | None = None): ... +def one_exchange( + G: Graph[_Node], initial_cut: set[Incomplete] | None = None, seed: int | RandomState | None = None, weight: str | None = None +): ... diff --git a/stubs/networkx/networkx/algorithms/approximation/ramsey.pyi b/stubs/networkx/networkx/algorithms/approximation/ramsey.pyi index 5b85df65d7bb..1769ec99285b 100644 --- a/stubs/networkx/networkx/algorithms/approximation/ramsey.pyi +++ b/stubs/networkx/networkx/algorithms/approximation/ramsey.pyi @@ -1,4 +1,5 @@ +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def ramsey_R2(G): ... +def ramsey_R2(G: Graph[_Node]): ... diff --git a/stubs/networkx/networkx/algorithms/approximation/steinertree.pyi b/stubs/networkx/networkx/algorithms/approximation/steinertree.pyi index 03d0f6742be6..f75bd9023db9 100644 --- a/stubs/networkx/networkx/algorithms/approximation/steinertree.pyi +++ b/stubs/networkx/networkx/algorithms/approximation/steinertree.pyi @@ -1,8 +1,10 @@ from _typeshed import Incomplete +from collections.abc import Iterable +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def metric_closure(G, weight: str = "weight"): ... +def metric_closure(G: Graph[_Node], weight="weight"): ... @_dispatchable -def steiner_tree(G, terminal_nodes, weight: str = "weight", method: Incomplete | None = None): ... +def steiner_tree(G: Graph[_Node], terminal_nodes: Iterable[Incomplete], weight: str = "weight", method: str | None = None): ... diff --git a/stubs/networkx/networkx/algorithms/approximation/traveling_salesman.pyi b/stubs/networkx/networkx/algorithms/approximation/traveling_salesman.pyi index e44e31519d14..bccba05d805d 100644 --- a/stubs/networkx/networkx/algorithms/approximation/traveling_salesman.pyi +++ b/stubs/networkx/networkx/algorithms/approximation/traveling_salesman.pyi @@ -1,41 +1,51 @@ from _typeshed import Incomplete +from collections.abc import Callable +from networkx.classes.digraph import DiGraph +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable +from numpy.random import RandomState @_dispatchable -def christofides(G, weight: str = "weight", tree: Incomplete | None = None): ... +def christofides(G: Graph[_Node], weight: str | None = "weight", tree: Graph[_Node] | None = None): ... @_dispatchable def traveling_salesman_problem( - G, weight: str = "weight", nodes: Incomplete | None = None, cycle: bool = True, method: Incomplete | None = None, **kwargs + G: Graph[_Node], + weight: str = "weight", + nodes=None, + cycle: bool = True, + method: Callable[..., Incomplete] | None = None, + **kwargs, ): ... @_dispatchable -def asadpour_atsp(G, weight: str = "weight", seed: Incomplete | None = None, source: Incomplete | None = None): ... +def asadpour_atsp( + G: DiGraph[_Node], weight: str | None = "weight", seed: int | RandomState | None = None, source: str | None = None +): ... @_dispatchable -def greedy_tsp(G, weight: str = "weight", source: Incomplete | None = None): ... +def greedy_tsp(G: Graph[_Node], weight: str | None = "weight", source=None): ... @_dispatchable def simulated_annealing_tsp( - G, + G: Graph[_Node], init_cycle, - weight: str = "weight", - source: Incomplete | None = None, - # docstring says int, but it can be a float and does become a float mid-equation if alpha is also a float - temp: float = 100, - move: str = "1-1", - max_iterations: int = 10, - N_inner: int = 100, - alpha: float = 0.01, - seed: Incomplete | None = None, + weight: str | None = "weight", + source=None, + temp: int | None = 100, + move="1-1", + max_iterations: int | None = 10, + N_inner: int | None = 100, + alpha=0.01, + seed: int | RandomState | None = None, ): ... @_dispatchable def threshold_accepting_tsp( - G, + G: Graph[_Node], init_cycle, - weight: str = "weight", - source: Incomplete | None = None, - threshold: float = 1, - move: str = "1-1", - max_iterations: int = 10, - N_inner: int = 100, - alpha: float = 0.1, - seed: Incomplete | None = None, + weight: str | None = "weight", + source=None, + threshold: int | None = 1, + move="1-1", + max_iterations: int | None = 10, + N_inner: int | None = 100, + alpha=0.1, + seed: int | RandomState | None = None, ): ... diff --git a/stubs/networkx/networkx/algorithms/approximation/treewidth.pyi b/stubs/networkx/networkx/algorithms/approximation/treewidth.pyi index 5a68247f5b49..0b970f4c5cc1 100644 --- a/stubs/networkx/networkx/algorithms/approximation/treewidth.pyi +++ b/stubs/networkx/networkx/algorithms/approximation/treewidth.pyi @@ -1,15 +1,17 @@ from _typeshed import Incomplete +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable __all__ = ["treewidth_min_degree", "treewidth_min_fill_in"] @_dispatchable -def treewidth_min_degree(G): ... +def treewidth_min_degree(G: Graph[_Node]): ... @_dispatchable -def treewidth_min_fill_in(G): ... +def treewidth_min_fill_in(G: Graph[_Node]): ... class MinDegreeHeuristic: count: Incomplete + def __init__(self, graph) -> None: ... def best_node(self, graph): ... diff --git a/stubs/networkx/networkx/algorithms/approximation/vertex_cover.pyi b/stubs/networkx/networkx/algorithms/approximation/vertex_cover.pyi index 22c5787bf983..26d3fb82b1bb 100644 --- a/stubs/networkx/networkx/algorithms/approximation/vertex_cover.pyi +++ b/stubs/networkx/networkx/algorithms/approximation/vertex_cover.pyi @@ -1,6 +1,5 @@ -from _typeshed import Incomplete - +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def min_weighted_vertex_cover(G, weight: Incomplete | None = None): ... +def min_weighted_vertex_cover(G: Graph[_Node], weight: str | None = None): ... diff --git a/stubs/networkx/networkx/algorithms/assortativity/connectivity.pyi b/stubs/networkx/networkx/algorithms/assortativity/connectivity.pyi index 36c7f64e46e2..3c0c202c56e8 100644 --- a/stubs/networkx/networkx/algorithms/assortativity/connectivity.pyi +++ b/stubs/networkx/networkx/algorithms/assortativity/connectivity.pyi @@ -1,8 +1,10 @@ from _typeshed import Incomplete +from collections.abc import Iterable +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable def average_degree_connectivity( - G, source: str = "in+out", target: str = "in+out", nodes: Incomplete | None = None, weight: Incomplete | None = None + G: Graph[_Node], source="in+out", target="in+out", nodes: Iterable[Incomplete] | None = None, weight: str | None = None ): ... diff --git a/stubs/networkx/networkx/algorithms/assortativity/correlation.pyi b/stubs/networkx/networkx/algorithms/assortativity/correlation.pyi index dec6b0595556..9fe4866db3d8 100644 --- a/stubs/networkx/networkx/algorithms/assortativity/correlation.pyi +++ b/stubs/networkx/networkx/algorithms/assortativity/correlation.pyi @@ -1,16 +1,18 @@ from _typeshed import Incomplete +from collections.abc import Iterable +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable def degree_assortativity_coefficient( - G, x: str = "out", y: str = "in", weight: Incomplete | None = None, nodes: Incomplete | None = None + G: Graph[_Node], x: str = "out", y: str = "in", weight: str | None = None, nodes: Iterable[Incomplete] | None = None ): ... @_dispatchable def degree_pearson_correlation_coefficient( - G, x: str = "out", y: str = "in", weight: Incomplete | None = None, nodes: Incomplete | None = None + G: Graph[_Node], x: str = "out", y: str = "in", weight: str | None = None, nodes: Iterable[Incomplete] | None = None ): ... @_dispatchable -def attribute_assortativity_coefficient(G, attribute, nodes: Incomplete | None = None): ... +def attribute_assortativity_coefficient(G: Graph[_Node], attribute: str, nodes: Iterable[Incomplete] | None = None): ... @_dispatchable -def numeric_assortativity_coefficient(G, attribute, nodes: Incomplete | None = None): ... +def numeric_assortativity_coefficient(G: Graph[_Node], attribute: str, nodes: Iterable[Incomplete] | None = None): ... diff --git a/stubs/networkx/networkx/algorithms/assortativity/mixing.pyi b/stubs/networkx/networkx/algorithms/assortativity/mixing.pyi index 06e19e1f68d5..c80fdae4eadb 100644 --- a/stubs/networkx/networkx/algorithms/assortativity/mixing.pyi +++ b/stubs/networkx/networkx/algorithms/assortativity/mixing.pyi @@ -1,26 +1,34 @@ -from _typeshed import Incomplete +from _typeshed import Incomplete, SupportsGetItem +from collections.abc import Iterable +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def attribute_mixing_dict(G, attribute, nodes: Incomplete | None = None, normalized: bool = False): ... +def attribute_mixing_dict( + G: Graph[_Node], attribute: str, nodes: Iterable[Incomplete] | None = None, normalized: bool = False +): ... @_dispatchable def attribute_mixing_matrix( - G, attribute, nodes: Incomplete | None = None, mapping: Incomplete | None = None, normalized: bool = True + G: Graph[_Node], + attribute: str, + nodes: Iterable[Incomplete] | None = None, + mapping: SupportsGetItem[Incomplete, Incomplete] | None = None, + normalized: bool = True, ): ... @_dispatchable def degree_mixing_dict( - G, x: str = "out", y: str = "in", weight: Incomplete | None = None, nodes: Incomplete | None = None, normalized: bool = False + G: Graph[_Node], x: str = "out", y: str = "in", weight: str | None = None, nodes=None, normalized: bool = False ): ... @_dispatchable def degree_mixing_matrix( - G, + G: Graph[_Node], x: str = "out", y: str = "in", - weight: Incomplete | None = None, - nodes: Incomplete | None = None, + weight: str | None = None, + nodes: Iterable[Incomplete] | None = None, normalized: bool = True, - mapping: Incomplete | None = None, + mapping: SupportsGetItem[Incomplete, Incomplete] | None = None, ): ... @_dispatchable def mixing_dict(xy, normalized: bool = False): ... diff --git a/stubs/networkx/networkx/algorithms/assortativity/neighbor_degree.pyi b/stubs/networkx/networkx/algorithms/assortativity/neighbor_degree.pyi index 6cc1b1322d2a..042777067212 100644 --- a/stubs/networkx/networkx/algorithms/assortativity/neighbor_degree.pyi +++ b/stubs/networkx/networkx/algorithms/assortativity/neighbor_degree.pyi @@ -1,8 +1,14 @@ from _typeshed import Incomplete +from collections.abc import Iterable +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable def average_neighbor_degree( - G, source: str = "out", target: str = "out", nodes: Incomplete | None = None, weight: Incomplete | None = None + G: Graph[_Node], + source: str | None = "out", + target: str | None = "out", + nodes: Iterable[Incomplete] | None = None, + weight: str | None = None, ): ... diff --git a/stubs/networkx/networkx/algorithms/assortativity/pairs.pyi b/stubs/networkx/networkx/algorithms/assortativity/pairs.pyi index 569d52653ee5..4e9fb3c7516b 100644 --- a/stubs/networkx/networkx/algorithms/assortativity/pairs.pyi +++ b/stubs/networkx/networkx/algorithms/assortativity/pairs.pyi @@ -1,11 +1,14 @@ from _typeshed import Incomplete -from collections.abc import Generator +from collections.abc import Generator, Iterable +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def node_attribute_xy(G, attribute, nodes: Incomplete | None = None) -> Generator[Incomplete, None, None]: ... +def node_attribute_xy( + G: Graph[_Node], attribute, nodes: Iterable[Incomplete] | None = None +) -> Generator[Incomplete, None, None]: ... @_dispatchable def node_degree_xy( - G, x: str = "out", y: str = "in", weight: Incomplete | None = None, nodes: Incomplete | None = None + G: Graph[_Node], x: str = "out", y: str = "in", weight: str | None = None, nodes: Iterable[Incomplete] | None = None ) -> Generator[Incomplete, None, None]: ... diff --git a/stubs/networkx/networkx/algorithms/asteroidal.pyi b/stubs/networkx/networkx/algorithms/asteroidal.pyi index 4d12ecadaecd..21fdc6879686 100644 --- a/stubs/networkx/networkx/algorithms/asteroidal.pyi +++ b/stubs/networkx/networkx/algorithms/asteroidal.pyi @@ -1,6 +1,7 @@ +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def find_asteroidal_triple(G): ... +def find_asteroidal_triple(G: Graph[_Node]): ... @_dispatchable -def is_at_free(G): ... +def is_at_free(G: Graph[_Node]): ... diff --git a/stubs/networkx/networkx/algorithms/bipartite/__init__.pyi b/stubs/networkx/networkx/algorithms/bipartite/__init__.pyi index 1f279a092959..0df90e4f1d7d 100644 --- a/stubs/networkx/networkx/algorithms/bipartite/__init__.pyi +++ b/stubs/networkx/networkx/algorithms/bipartite/__init__.pyi @@ -3,6 +3,7 @@ from networkx.algorithms.bipartite.centrality import * from networkx.algorithms.bipartite.cluster import * from networkx.algorithms.bipartite.covering import * from networkx.algorithms.bipartite.edgelist import * +from networkx.algorithms.bipartite.extendability import * from networkx.algorithms.bipartite.generators import * from networkx.algorithms.bipartite.matching import * from networkx.algorithms.bipartite.matrix import * diff --git a/stubs/networkx/networkx/algorithms/bipartite/basic.pyi b/stubs/networkx/networkx/algorithms/bipartite/basic.pyi index f7fd955bb524..c8d80a1b642d 100644 --- a/stubs/networkx/networkx/algorithms/bipartite/basic.pyi +++ b/stubs/networkx/networkx/algorithms/bipartite/basic.pyi @@ -1,16 +1,18 @@ from _typeshed import Incomplete +from collections.abc import Iterable +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def color(G): ... +def color(G: Graph[_Node]): ... @_dispatchable -def is_bipartite(G): ... +def is_bipartite(G: Graph[_Node]): ... @_dispatchable -def is_bipartite_node_set(G, nodes): ... +def is_bipartite_node_set(G: Graph[_Node], nodes): ... @_dispatchable -def sets(G, top_nodes: Incomplete | None = None): ... +def sets(G: Graph[_Node], top_nodes: Iterable[Incomplete] | None = None): ... @_dispatchable -def density(B, nodes): ... +def density(B: Graph[_Node], nodes): ... @_dispatchable -def degrees(B, nodes, weight: Incomplete | None = None): ... +def degrees(B: Graph[_Node], nodes, weight: str | None = None): ... diff --git a/stubs/networkx/networkx/algorithms/bipartite/centrality.pyi b/stubs/networkx/networkx/algorithms/bipartite/centrality.pyi index 9d011ac139c2..fdd6212831f1 100644 --- a/stubs/networkx/networkx/algorithms/bipartite/centrality.pyi +++ b/stubs/networkx/networkx/algorithms/bipartite/centrality.pyi @@ -1,8 +1,9 @@ +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def degree_centrality(G, nodes): ... +def degree_centrality(G: Graph[_Node], nodes): ... @_dispatchable -def betweenness_centrality(G, nodes): ... +def betweenness_centrality(G: Graph[_Node], nodes): ... @_dispatchable -def closeness_centrality(G, nodes, normalized: bool = True): ... +def closeness_centrality(G: Graph[_Node], nodes, normalized: bool | None = True): ... diff --git a/stubs/networkx/networkx/algorithms/bipartite/cluster.pyi b/stubs/networkx/networkx/algorithms/bipartite/cluster.pyi index e6d15445c985..7fed50d545d0 100644 --- a/stubs/networkx/networkx/algorithms/bipartite/cluster.pyi +++ b/stubs/networkx/networkx/algorithms/bipartite/cluster.pyi @@ -1,13 +1,15 @@ from _typeshed import Incomplete +from collections.abc import Iterable +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def latapy_clustering(G, nodes: Incomplete | None = None, mode: str = "dot"): ... +def latapy_clustering(G: Graph[_Node], nodes: Iterable[Incomplete] | None = None, mode: str = "dot"): ... clustering = latapy_clustering @_dispatchable -def average_clustering(G, nodes: Incomplete | None = None, mode: str = "dot"): ... +def average_clustering(G: Graph[_Node], nodes: Iterable[Incomplete] | None = None, mode: str = "dot"): ... @_dispatchable -def robins_alexander_clustering(G): ... +def robins_alexander_clustering(G: Graph[_Node]): ... diff --git a/stubs/networkx/networkx/algorithms/bipartite/covering.pyi b/stubs/networkx/networkx/algorithms/bipartite/covering.pyi index 521e6d4956af..9d9fe9758baf 100644 --- a/stubs/networkx/networkx/algorithms/bipartite/covering.pyi +++ b/stubs/networkx/networkx/algorithms/bipartite/covering.pyi @@ -1,6 +1,8 @@ from _typeshed import Incomplete +from collections.abc import Callable +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def min_edge_cover(G, matching_algorithm: Incomplete | None = None): ... +def min_edge_cover(G: Graph[_Node], matching_algorithm: Callable[..., Incomplete] | None = None): ... diff --git a/stubs/networkx/networkx/algorithms/bipartite/edgelist.pyi b/stubs/networkx/networkx/algorithms/bipartite/edgelist.pyi index 009222121126..73ca8035db9e 100644 --- a/stubs/networkx/networkx/algorithms/bipartite/edgelist.pyi +++ b/stubs/networkx/networkx/algorithms/bipartite/edgelist.pyi @@ -1,6 +1,7 @@ from _typeshed import Incomplete from collections.abc import Generator +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable @@ -10,20 +11,20 @@ def generate_edgelist(G, delimiter: str = " ", data: bool = True) -> Generator[I @_dispatchable def parse_edgelist( lines, - comments: str = "#", - delimiter: Incomplete | None = None, - create_using: Incomplete | None = None, - nodetype: Incomplete | None = None, - data: bool = True, + comments: str | None = "#", + delimiter: str | None = None, + create_using: Graph[_Node] | None = None, + nodetype=None, + data=True, ): ... @_dispatchable def read_edgelist( path, - comments: str = "#", - delimiter: Incomplete | None = None, - create_using: Incomplete | None = None, - nodetype: Incomplete | None = None, - data: bool = True, - edgetype: Incomplete | None = None, - encoding: str = "utf-8", + comments: str | None = "#", + delimiter: str | None = None, + create_using=None, + nodetype=None, + data=True, + edgetype=None, + encoding: str | None = "utf-8", ): ... diff --git a/stubs/networkx/networkx/algorithms/bipartite/extendability.pyi b/stubs/networkx/networkx/algorithms/bipartite/extendability.pyi new file mode 100644 index 000000000000..9bfee7872513 --- /dev/null +++ b/stubs/networkx/networkx/algorithms/bipartite/extendability.pyi @@ -0,0 +1,5 @@ +from networkx.classes.graph import Graph, _Node +from networkx.utils.backends import _dispatchable + +@_dispatchable +def maximal_extendability(G: Graph[_Node]): ... diff --git a/stubs/networkx/networkx/algorithms/bipartite/generators.pyi b/stubs/networkx/networkx/algorithms/bipartite/generators.pyi index 9e1914567a50..3fe8b22ca59e 100644 --- a/stubs/networkx/networkx/algorithms/bipartite/generators.pyi +++ b/stubs/networkx/networkx/algorithms/bipartite/generators.pyi @@ -1,20 +1,34 @@ from _typeshed import Incomplete +from collections.abc import Iterable +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable +from numpy.random import RandomState @_dispatchable -def complete_bipartite_graph(n1, n2, create_using: Incomplete | None = None): ... +def complete_bipartite_graph(n1, n2, create_using: Graph[_Node] | None = None): ... @_dispatchable -def configuration_model(aseq, bseq, create_using: Incomplete | None = None, seed: Incomplete | None = None): ... +def configuration_model( + aseq: Iterable[Incomplete], + bseq: Iterable[Incomplete], + create_using: Graph[_Node] | None = None, + seed: int | RandomState | None = None, +): ... @_dispatchable -def havel_hakimi_graph(aseq, bseq, create_using: Incomplete | None = None): ... +def havel_hakimi_graph(aseq: Iterable[Incomplete], bseq: Iterable[Incomplete], create_using: Graph[_Node] | None = None): ... @_dispatchable -def reverse_havel_hakimi_graph(aseq, bseq, create_using: Incomplete | None = None): ... +def reverse_havel_hakimi_graph( + aseq: Iterable[Incomplete], bseq: Iterable[Incomplete], create_using: Graph[_Node] | None = None +): ... @_dispatchable -def alternating_havel_hakimi_graph(aseq, bseq, create_using: Incomplete | None = None): ... +def alternating_havel_hakimi_graph( + aseq: Iterable[Incomplete], bseq: Iterable[Incomplete], create_using: Graph[_Node] | None = None +): ... @_dispatchable -def preferential_attachment_graph(aseq, p, create_using: Incomplete | None = None, seed: Incomplete | None = None): ... +def preferential_attachment_graph( + aseq: Iterable[Incomplete], p: float, create_using: Graph[_Node] | None = None, seed: int | RandomState | None = None +): ... @_dispatchable -def random_graph(n, m, p, seed: Incomplete | None = None, directed: bool = False): ... +def random_graph(n: int, m: int, p: float, seed: int | RandomState | None = None, directed: bool | None = False): ... @_dispatchable -def gnmk_random_graph(n, m, k, seed: Incomplete | None = None, directed: bool = False): ... +def gnmk_random_graph(n: int, m: int, k: int, seed: int | RandomState | None = None, directed: bool | None = False): ... diff --git a/stubs/networkx/networkx/algorithms/bipartite/matching.pyi b/stubs/networkx/networkx/algorithms/bipartite/matching.pyi index a731c33b88d2..b744c44f2e34 100644 --- a/stubs/networkx/networkx/algorithms/bipartite/matching.pyi +++ b/stubs/networkx/networkx/algorithms/bipartite/matching.pyi @@ -1,15 +1,21 @@ -from _typeshed import Incomplete +from _typeshed import Incomplete, SupportsGetItem +from collections.abc import Iterable +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def hopcroft_karp_matching(G, top_nodes: Incomplete | None = None): ... +def hopcroft_karp_matching(G: Graph[_Node], top_nodes: Iterable[_Node] | None = None): ... @_dispatchable -def eppstein_matching(G, top_nodes: Incomplete | None = None): ... +def eppstein_matching(G: Graph[_Node], top_nodes: Iterable[Incomplete] | None = None): ... @_dispatchable -def to_vertex_cover(G, matching, top_nodes: Incomplete | None = None): ... +def to_vertex_cover( + G: Graph[_Node], matching: SupportsGetItem[Incomplete, Incomplete], top_nodes: Iterable[Incomplete] | None = None +): ... maximum_matching = hopcroft_karp_matching @_dispatchable -def minimum_weight_full_matching(G, top_nodes: Incomplete | None = None, weight: str = "weight"): ... +def minimum_weight_full_matching( + G: Graph[_Node], top_nodes: Iterable[Incomplete] | None = None, weight: str | None = "weight" +): ... diff --git a/stubs/networkx/networkx/algorithms/bipartite/matrix.pyi b/stubs/networkx/networkx/algorithms/bipartite/matrix.pyi index 51a032fff0d8..f8a7af78c99b 100644 --- a/stubs/networkx/networkx/algorithms/bipartite/matrix.pyi +++ b/stubs/networkx/networkx/algorithms/bipartite/matrix.pyi @@ -1,15 +1,17 @@ from _typeshed import Incomplete +from collections.abc import Iterable +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable def biadjacency_matrix( - G, - row_order, - column_order: Incomplete | None = None, - dtype: Incomplete | None = None, - weight: str = "weight", - format: str = "csr", + G: Graph[_Node], + row_order: Iterable[_Node], + column_order: Iterable[Incomplete] | None = None, + dtype=None, + weight: str | None = "weight", + format="csr", ): ... @_dispatchable -def from_biadjacency_matrix(A, create_using: Incomplete | None = None, edge_attribute: str = "weight"): ... +def from_biadjacency_matrix(A, create_using: Graph[_Node] | None = None, edge_attribute: str = "weight"): ... diff --git a/stubs/networkx/networkx/algorithms/bipartite/projection.pyi b/stubs/networkx/networkx/algorithms/bipartite/projection.pyi index 37712b7840a4..c545b78ff61e 100644 --- a/stubs/networkx/networkx/algorithms/bipartite/projection.pyi +++ b/stubs/networkx/networkx/algorithms/bipartite/projection.pyi @@ -1,14 +1,18 @@ from _typeshed import Incomplete +from collections.abc import Callable, Iterable +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def projected_graph(B, nodes, multigraph: bool = False): ... +def projected_graph(B: Graph[_Node], nodes: Iterable[Incomplete], multigraph: bool = False): ... @_dispatchable -def weighted_projected_graph(B, nodes, ratio: bool = False): ... +def weighted_projected_graph(B: Graph[_Node], nodes: Iterable[Incomplete], ratio: bool = False): ... @_dispatchable -def collaboration_weighted_projected_graph(B, nodes): ... +def collaboration_weighted_projected_graph(B: Graph[_Node], nodes: Iterable[Incomplete]): ... @_dispatchable -def overlap_weighted_projected_graph(B, nodes, jaccard: bool = True): ... +def overlap_weighted_projected_graph(B: Graph[_Node], nodes: Iterable[Incomplete], jaccard: bool = True): ... @_dispatchable -def generic_weighted_projected_graph(B, nodes, weight_function: Incomplete | None = None): ... +def generic_weighted_projected_graph( + B: Graph[_Node], nodes: Iterable[Incomplete], weight_function: Callable[..., Incomplete] | None = None +): ... diff --git a/stubs/networkx/networkx/algorithms/bipartite/redundancy.pyi b/stubs/networkx/networkx/algorithms/bipartite/redundancy.pyi index 8c66512fc95a..474329b6e68e 100644 --- a/stubs/networkx/networkx/algorithms/bipartite/redundancy.pyi +++ b/stubs/networkx/networkx/algorithms/bipartite/redundancy.pyi @@ -1,6 +1,8 @@ from _typeshed import Incomplete +from collections.abc import Iterable +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def node_redundancy(G, nodes: Incomplete | None = None): ... +def node_redundancy(G: Graph[_Node], nodes: Iterable[Incomplete] | None = None): ... diff --git a/stubs/networkx/networkx/algorithms/bipartite/spectral.pyi b/stubs/networkx/networkx/algorithms/bipartite/spectral.pyi index 4a81f118acbf..c3060cce5cda 100644 --- a/stubs/networkx/networkx/algorithms/bipartite/spectral.pyi +++ b/stubs/networkx/networkx/algorithms/bipartite/spectral.pyi @@ -1,6 +1,5 @@ -from _typeshed import Incomplete - +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def spectral_bipartivity(G, nodes: Incomplete | None = None, weight: str = "weight"): ... +def spectral_bipartivity(G: Graph[_Node], nodes=None, weight: str = "weight"): ... diff --git a/stubs/networkx/networkx/algorithms/boundary.pyi b/stubs/networkx/networkx/algorithms/boundary.pyi index 3b5cfa511a38..e85644bef42f 100644 --- a/stubs/networkx/networkx/algorithms/boundary.pyi +++ b/stubs/networkx/networkx/algorithms/boundary.pyi @@ -1,6 +1,6 @@ from _typeshed import Incomplete from collections.abc import Generator, Iterable -from typing import Literal, TypeVar, overload +from typing import TypeVar, overload from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @@ -10,106 +10,101 @@ _U = TypeVar("_U") @overload def edge_boundary( G: Graph[_Node], - nbunch1: Iterable[_Node], - nbunch2: Iterable[_Node] | None = None, - data: Literal[False] = False, - keys: Literal[False] = False, - default=None, + nbunch1: Iterable[Incomplete], + nbunch2: Iterable[Incomplete] | None = None, + data=False, + keys: bool = False, + default: Incomplete | None = None, ) -> Generator[tuple[_Node, _Node], None, None]: ... @overload def edge_boundary( G: Graph[_Node], - nbunch1: Iterable[_Node], - nbunch2: Iterable[_Node] | None, - data: Literal[True], - keys: Literal[False] = False, - default=None, + nbunch1: Iterable[Incomplete], + nbunch2: Iterable[Incomplete] | None = None, + data=False, + keys: bool = False, + default: Incomplete | None = None, ) -> Generator[tuple[_Node, _Node, dict[str, Incomplete]], None, None]: ... @overload def edge_boundary( G: Graph[_Node], - nbunch1: Iterable[_Node], - nbunch2: Iterable[_Node] | None = None, - *, - data: Literal[True], - keys: Literal[False] = False, - default=None, + nbunch1: Iterable[Incomplete], + nbunch2: Iterable[Incomplete] | None = None, + data=False, + keys: bool = False, + default: Incomplete | None = None, ) -> Generator[tuple[_Node, _Node, dict[str, Incomplete]], None, None]: ... @overload def edge_boundary( G: Graph[_Node], - nbunch1: Iterable[_Node], - nbunch2: Iterable[_Node] | None, - data: str, - keys: Literal[False] = False, + nbunch1: Iterable[Incomplete], + nbunch2: Iterable[Incomplete] | None = None, + data=False, + keys: bool = False, default: _U | None = None, ) -> Generator[tuple[_Node, _Node, dict[str, _U]], None, None]: ... @overload def edge_boundary( G: Graph[_Node], - nbunch1: Iterable[_Node], - nbunch2: Iterable[_Node] | None = None, - *, - data: str, - keys: Literal[False] = False, + nbunch1: Iterable[Incomplete], + nbunch2: Iterable[Incomplete] | None = None, + data=False, + keys: bool = False, default: _U | None = None, ) -> Generator[tuple[_Node, _Node, dict[str, _U]], None, None]: ... @overload def edge_boundary( G: Graph[_Node], - nbunch1: Iterable[_Node], - nbunch2: Iterable[_Node] | None, - data: Literal[False], - keys: Literal[True], - default=None, + nbunch1: Iterable[Incomplete], + nbunch2: Iterable[Incomplete] | None = None, + data=False, + keys: bool = False, + default: Incomplete | None = None, ) -> Generator[tuple[_Node, _Node, int], None, None]: ... @overload def edge_boundary( G: Graph[_Node], - nbunch1: Iterable[_Node], - nbunch2: Iterable[_Node] | None = None, - data: Literal[False] = False, - *, - keys: Literal[True], - default=None, + nbunch1: Iterable[Incomplete], + nbunch2: Iterable[Incomplete] | None = None, + data=False, + keys: bool = False, + default: Incomplete | None = None, ) -> Generator[tuple[_Node, _Node, int], None, None]: ... @overload def edge_boundary( G: Graph[_Node], - nbunch1: Iterable[_Node], - nbunch2: Iterable[_Node] | None, - data: Literal[True], - keys: Literal[True], - default=None, + nbunch1: Iterable[Incomplete], + nbunch2: Iterable[Incomplete] | None = None, + data=False, + keys: bool = False, + default: Incomplete | None = None, ) -> Generator[tuple[_Node, _Node, int, dict[str, Incomplete]], None, None]: ... @overload def edge_boundary( G: Graph[_Node], - nbunch1: Iterable[_Node], - nbunch2: Iterable[_Node] | None = None, - *, - data: Literal[True], - keys: Literal[True], - default=None, + nbunch1: Iterable[Incomplete], + nbunch2: Iterable[Incomplete] | None = None, + data=False, + keys: bool = False, + default: Incomplete | None = None, ) -> Generator[tuple[_Node, _Node, int, dict[str, Incomplete]], None, None]: ... @overload def edge_boundary( G: Graph[_Node], - nbunch1: Iterable[_Node], - nbunch2: Iterable[_Node] | None, - data: str, - keys: Literal[True], + nbunch1: Iterable[Incomplete], + nbunch2: Iterable[Incomplete] | None = None, + data=False, + keys: bool = False, default: _U | None = None, ) -> Generator[tuple[_Node, _Node, int, dict[str, _U]], None, None]: ... @overload def edge_boundary( G: Graph[_Node], - nbunch1: Iterable[_Node], - nbunch2: Iterable[_Node] | None = None, - *, - data: str, - keys: Literal[True], + nbunch1: Iterable[Incomplete], + nbunch2: Iterable[Incomplete] | None = None, + data=False, + keys: bool = False, default: _U | None = None, ) -> Generator[tuple[_Node, _Node, int, dict[str, _U]], None, None]: ... @_dispatchable -def node_boundary(G: Graph[_Node], nbunch1: Iterable[_Node], nbunch2: Iterable[_Node] | None = None) -> set[_Node]: ... +def node_boundary(G: Graph[_Node], nbunch1: Iterable[Incomplete], nbunch2: Iterable[Incomplete] | None = None) -> set[_Node]: ... diff --git a/stubs/networkx/networkx/algorithms/bridges.pyi b/stubs/networkx/networkx/algorithms/bridges.pyi index 35fa914d6f90..2beb94e80077 100644 --- a/stubs/networkx/networkx/algorithms/bridges.pyi +++ b/stubs/networkx/networkx/algorithms/bridges.pyi @@ -1,6 +1,5 @@ -from _typeshed import Incomplete -from collections.abc import Callable, Generator -from typing import Literal, overload +from collections.abc import Generator +from typing import overload from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @@ -8,12 +7,12 @@ from networkx.utils.backends import _dispatchable @_dispatchable def bridges(G: Graph[_Node], root: _Node | None = None) -> Generator[_Node, None, None]: ... @_dispatchable -def has_bridges(G: Graph[_Node], root: Incomplete | None = None) -> bool: ... +def has_bridges(G: Graph[_Node], root: _Node | None = None) -> bool: ... @overload def local_bridges( - G: Graph[_Node], with_span: Literal[False], weight: str | Callable[[_Node], float] | None = None + G: Graph[_Node], with_span: bool = True, weight: str | None = None ) -> Generator[tuple[_Node, _Node], None, None]: ... @overload def local_bridges( - G: Graph[_Node], with_span: Literal[True] = True, weight: str | Callable[[_Node], float] | None = None + G: Graph[_Node], with_span: bool = True, weight: str | None = None ) -> Generator[tuple[_Node, _Node, int], None, None]: ... diff --git a/stubs/networkx/networkx/algorithms/centrality/betweenness.pyi b/stubs/networkx/networkx/algorithms/centrality/betweenness.pyi index 5475cfecb789..7d8351a67c5a 100644 --- a/stubs/networkx/networkx/algorithms/centrality/betweenness.pyi +++ b/stubs/networkx/networkx/algorithms/centrality/betweenness.pyi @@ -1,5 +1,3 @@ -from _typeshed import Incomplete - from networkx.classes.graph import Graph, _Edge, _Node from networkx.utils.backends import _dispatchable from numpy.random import RandomState @@ -8,12 +6,16 @@ from numpy.random import RandomState def betweenness_centrality( G: Graph[_Node], k: int | None = None, - normalized: bool = True, + normalized: bool | None = True, weight: str | None = None, - endpoints: bool = False, + endpoints: bool | None = False, seed: int | RandomState | None = None, ) -> dict[_Node, float]: ... @_dispatchable def edge_betweenness_centrality( - G: Graph[_Node], k: int | None = None, normalized: bool = True, weight: str | None = None, seed: Incomplete | None = None + G: Graph[_Node], + k: int | None = None, + normalized: bool | None = True, + weight: str | None = None, + seed: int | RandomState | None = None, ) -> dict[_Edge[_Node], float]: ... diff --git a/stubs/networkx/networkx/algorithms/centrality/betweenness_subset.pyi b/stubs/networkx/networkx/algorithms/centrality/betweenness_subset.pyi index 66abb8533ad4..3f3af3e5bbae 100644 --- a/stubs/networkx/networkx/algorithms/centrality/betweenness_subset.pyi +++ b/stubs/networkx/networkx/algorithms/centrality/betweenness_subset.pyi @@ -5,9 +5,17 @@ from networkx.utils.backends import _dispatchable @_dispatchable def betweenness_centrality_subset( - G: Graph[_Node], sources: Iterable[_Node], targets: Iterable[_Node], normalized: bool = False, weight: str | None = None + G: Graph[_Node], + sources: Iterable[_Node], + targets: Iterable[_Node], + normalized: bool | None = False, + weight: str | None = None, ) -> dict[_Node, float]: ... @_dispatchable def edge_betweenness_centrality_subset( - G: Graph[_Node], sources: Iterable[_Node], targets: Iterable[_Node], normalized: bool = False, weight: str | None = None + G: Graph[_Node], + sources: Iterable[_Node], + targets: Iterable[_Node], + normalized: bool | None = False, + weight: str | None = None, ) -> dict[_Edge[_Node], float]: ... diff --git a/stubs/networkx/networkx/algorithms/centrality/closeness.pyi b/stubs/networkx/networkx/algorithms/centrality/closeness.pyi index 210e88bc7218..edfae3a7b828 100644 --- a/stubs/networkx/networkx/algorithms/centrality/closeness.pyi +++ b/stubs/networkx/networkx/algorithms/centrality/closeness.pyi @@ -1,17 +1,17 @@ -from _typeshed import SupportsKeysAndGetItem +from _typeshed import Incomplete, SupportsGetItem -from networkx.classes.graph import Graph, _Edge, _Node +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable def closeness_centrality( - G: Graph[_Node], u: _Node | None = None, distance: str | None = None, wf_improved: bool = True + G: Graph[_Node], u: _Node | None = None, distance=None, wf_improved: bool | None = True ) -> dict[_Node, float]: ... @_dispatchable def incremental_closeness_centrality( G: Graph[_Node], - edge: _Edge[_Node], - prev_cc: SupportsKeysAndGetItem[_Node, float] | None = None, - insertion: bool = True, - wf_improved: bool = True, + edge: tuple[Incomplete], + prev_cc: SupportsGetItem[Incomplete, Incomplete] | None = None, + insertion: bool | None = True, + wf_improved: bool | None = True, ) -> dict[_Node, float]: ... diff --git a/stubs/networkx/networkx/algorithms/centrality/current_flow_betweenness.pyi b/stubs/networkx/networkx/algorithms/centrality/current_flow_betweenness.pyi index 612702be5b69..3995a217fefc 100644 --- a/stubs/networkx/networkx/algorithms/centrality/current_flow_betweenness.pyi +++ b/stubs/networkx/networkx/algorithms/centrality/current_flow_betweenness.pyi @@ -1,23 +1,23 @@ -from _typeshed import Incomplete - +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable +from numpy.random import RandomState @_dispatchable def approximate_current_flow_betweenness_centrality( - G, - normalized: bool = True, - weight: Incomplete | None = None, - dtype=..., + G: Graph[_Node], + normalized: bool | None = True, + weight: str | None = None, + dtype: type = ..., solver: str = "full", epsilon: float = 0.5, kmax: int = 10000, - seed: Incomplete | None = None, + seed: int | RandomState | None = None, ): ... @_dispatchable def current_flow_betweenness_centrality( - G, normalized: bool = True, weight: Incomplete | None = None, dtype=..., solver: str = "full" + G: Graph[_Node], normalized: bool | None = True, weight: str | None = None, dtype: type = ..., solver: str = "full" ): ... @_dispatchable def edge_current_flow_betweenness_centrality( - G, normalized: bool = True, weight: Incomplete | None = None, dtype=..., solver: str = "full" + G: Graph[_Node], normalized: bool | None = True, weight: str | None = None, dtype: type = ..., solver: str = "full" ): ... diff --git a/stubs/networkx/networkx/algorithms/centrality/current_flow_betweenness_subset.pyi b/stubs/networkx/networkx/algorithms/centrality/current_flow_betweenness_subset.pyi index a34c8461d5c4..7712c02ac954 100644 --- a/stubs/networkx/networkx/algorithms/centrality/current_flow_betweenness_subset.pyi +++ b/stubs/networkx/networkx/algorithms/centrality/current_flow_betweenness_subset.pyi @@ -1,12 +1,25 @@ -from _typeshed import Incomplete +from collections.abc import Iterable +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable def current_flow_betweenness_centrality_subset( - G, sources, targets, normalized: bool = True, weight: Incomplete | None = None, dtype=..., solver: str = "lu" + G: Graph[_Node], + sources: Iterable[_Node], + targets: Iterable[_Node], + normalized: bool | None = True, + weight: str | None = None, + dtype: type = ..., + solver: str = "lu", ): ... @_dispatchable def edge_current_flow_betweenness_centrality_subset( - G, sources, targets, normalized: bool = True, weight: Incomplete | None = None, dtype=..., solver: str = "lu" + G: Graph[_Node], + sources: Iterable[_Node], + targets: Iterable[_Node], + normalized: bool | None = True, + weight: str | None = None, + dtype: type = ..., + solver: str = "lu", ): ... diff --git a/stubs/networkx/networkx/algorithms/centrality/current_flow_closeness.pyi b/stubs/networkx/networkx/algorithms/centrality/current_flow_closeness.pyi index 81587a748915..534c06845d13 100644 --- a/stubs/networkx/networkx/algorithms/centrality/current_flow_closeness.pyi +++ b/stubs/networkx/networkx/algorithms/centrality/current_flow_closeness.pyi @@ -1,8 +1,7 @@ -from _typeshed import Incomplete - +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def current_flow_closeness_centrality(G, weight: Incomplete | None = None, dtype=..., solver: str = "lu"): ... +def current_flow_closeness_centrality(G: Graph[_Node], weight: str | None = None, dtype: type = ..., solver: str = "lu"): ... information_centrality = current_flow_closeness_centrality diff --git a/stubs/networkx/networkx/algorithms/centrality/eigenvector.pyi b/stubs/networkx/networkx/algorithms/centrality/eigenvector.pyi index cb0736e69f93..8c9ccd34c568 100644 --- a/stubs/networkx/networkx/algorithms/centrality/eigenvector.pyi +++ b/stubs/networkx/networkx/algorithms/centrality/eigenvector.pyi @@ -1,10 +1,17 @@ -from _typeshed import Incomplete +from _typeshed import Incomplete, SupportsGetItem +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable def eigenvector_centrality( - G, max_iter: int = 100, tol: float = 1e-06, nstart: Incomplete | None = None, weight: Incomplete | None = None + G: Graph[_Node], + max_iter: int | None = 100, + tol: float | None = 1e-06, + nstart: SupportsGetItem[Incomplete, Incomplete] | None = None, + weight: str | None = None, ): ... @_dispatchable -def eigenvector_centrality_numpy(G, weight: Incomplete | None = None, max_iter: int = 50, tol: float = 0): ... +def eigenvector_centrality_numpy( + G: Graph[_Node], weight: str | None = None, max_iter: int | None = 50, tol: float | None = 0 +): ... diff --git a/stubs/networkx/networkx/algorithms/centrality/flow_matrix.pyi b/stubs/networkx/networkx/algorithms/centrality/flow_matrix.pyi index 12a98580dbde..7b7f43908ffb 100644 --- a/stubs/networkx/networkx/algorithms/centrality/flow_matrix.pyi +++ b/stubs/networkx/networkx/algorithms/centrality/flow_matrix.pyi @@ -12,6 +12,7 @@ class InverseLaplacian: w: Incomplete C: Incomplete L1: Incomplete + def __init__(self, L, width: Incomplete | None = None, dtype: Incomplete | None = None) -> None: ... def init_solver(self, L) -> None: ... def solve(self, r) -> None: ... @@ -22,18 +23,21 @@ class InverseLaplacian: class FullInverseLaplacian(InverseLaplacian): IL: Incomplete + def init_solver(self, L) -> None: ... def solve(self, rhs): ... def solve_inverse(self, r): ... class SuperLUInverseLaplacian(InverseLaplacian): lusolve: Incomplete + def init_solver(self, L) -> None: ... def solve_inverse(self, r): ... def solve(self, rhs): ... class CGInverseLaplacian(InverseLaplacian): M: Incomplete + def init_solver(self, L) -> None: ... def solve(self, rhs): ... def solve_inverse(self, r): ... diff --git a/stubs/networkx/networkx/algorithms/centrality/group.pyi b/stubs/networkx/networkx/algorithms/centrality/group.pyi index a7cfa7a7c58a..3229bdec3789 100644 --- a/stubs/networkx/networkx/algorithms/centrality/group.pyi +++ b/stubs/networkx/networkx/algorithms/centrality/group.pyi @@ -1,24 +1,28 @@ from _typeshed import Incomplete +from collections.abc import Iterable +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def group_betweenness_centrality(G, C, normalized: bool = True, weight: Incomplete | None = None, endpoints: bool = False): ... +def group_betweenness_centrality( + G: Graph[_Node], C, normalized: bool | None = True, weight: str | None = None, endpoints: bool | None = False +): ... @_dispatchable def prominent_group( - G, - k, - weight: Incomplete | None = None, - C: Incomplete | None = None, - endpoints: bool = False, - normalized: bool = True, - greedy: bool = False, + G: Graph[_Node], + k: int, + weight: str | None = None, + C: Iterable[Incomplete] | None = None, + endpoints: bool | None = False, + normalized: bool | None = True, + greedy: bool | None = False, ): ... @_dispatchable -def group_closeness_centrality(G, S, weight: Incomplete | None = None): ... +def group_closeness_centrality(G: Graph[_Node], S: Iterable[Incomplete], weight: str | None = None): ... @_dispatchable -def group_degree_centrality(G, S): ... +def group_degree_centrality(G: Graph[_Node], S: Iterable[Incomplete]): ... @_dispatchable -def group_in_degree_centrality(G, S): ... +def group_in_degree_centrality(G: Graph[_Node], S: Iterable[Incomplete]): ... @_dispatchable -def group_out_degree_centrality(G, S): ... +def group_out_degree_centrality(G: Graph[_Node], S: Iterable[Incomplete]): ... diff --git a/stubs/networkx/networkx/algorithms/centrality/harmonic.pyi b/stubs/networkx/networkx/algorithms/centrality/harmonic.pyi index cd2aa8ca1747..af566d1c4d7d 100644 --- a/stubs/networkx/networkx/algorithms/centrality/harmonic.pyi +++ b/stubs/networkx/networkx/algorithms/centrality/harmonic.pyi @@ -1,8 +1,10 @@ from _typeshed import Incomplete +from collections.abc import Iterable +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable def harmonic_centrality( - G, nbunch: Incomplete | None = None, distance: Incomplete | None = None, sources: Incomplete | None = None + G: Graph[_Node], nbunch: Iterable[Incomplete] | None = None, distance=None, sources: Iterable[Incomplete] | None = None ): ... diff --git a/stubs/networkx/networkx/algorithms/centrality/katz.pyi b/stubs/networkx/networkx/algorithms/centrality/katz.pyi index 509456ff0ef9..ba353da7a8ce 100644 --- a/stubs/networkx/networkx/algorithms/centrality/katz.pyi +++ b/stubs/networkx/networkx/algorithms/centrality/katz.pyi @@ -1,19 +1,24 @@ -from _typeshed import Incomplete +from _typeshed import Incomplete, SupportsGetItem +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable def katz_centrality( - G, - alpha: float = 0.1, - beta: float = 1.0, - max_iter: int = 1000, - tol: float = 1e-06, - nstart: Incomplete | None = None, - normalized: bool = True, - weight: Incomplete | None = None, + G: Graph[_Node], + alpha: float | None = 0.1, + beta: float | SupportsGetItem[Incomplete, Incomplete] | None = 1.0, + max_iter: int | None = 1000, + tol: float | None = 1e-06, + nstart: SupportsGetItem[Incomplete, Incomplete] | None = None, + normalized: bool | None = True, + weight: str | None = None, ): ... @_dispatchable def katz_centrality_numpy( - G, alpha: float = 0.1, beta: float = 1.0, normalized: bool = True, weight: Incomplete | None = None + G: Graph[_Node], + alpha: float = 0.1, + beta: float | SupportsGetItem[Incomplete, Incomplete] | None = 1.0, + normalized: bool = True, + weight: str | None = None, ): ... diff --git a/stubs/networkx/networkx/algorithms/centrality/laplacian.pyi b/stubs/networkx/networkx/algorithms/centrality/laplacian.pyi index a1a79318dcb2..8dfdb2d0d11a 100644 --- a/stubs/networkx/networkx/algorithms/centrality/laplacian.pyi +++ b/stubs/networkx/networkx/algorithms/centrality/laplacian.pyi @@ -1,13 +1,15 @@ from _typeshed import Incomplete +from collections.abc import Iterable +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable def laplacian_centrality( - G, + G: Graph[_Node], normalized: bool = True, - nodelist: Incomplete | None = None, - weight: str = "weight", - walk_type: Incomplete | None = None, + nodelist: Iterable[Incomplete] | None = None, + weight: str | None = "weight", + walk_type: str | None = None, alpha: float = 0.95, ): ... diff --git a/stubs/networkx/networkx/algorithms/centrality/load.pyi b/stubs/networkx/networkx/algorithms/centrality/load.pyi index a3cb20b97eae..cdec3b843e77 100644 --- a/stubs/networkx/networkx/algorithms/centrality/load.pyi +++ b/stubs/networkx/networkx/algorithms/centrality/load.pyi @@ -1,15 +1,14 @@ -from _typeshed import Incomplete - +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable __all__ = ["load_centrality", "edge_load_centrality"] @_dispatchable def newman_betweenness_centrality( - G, v: Incomplete | None = None, cutoff: Incomplete | None = None, normalized: bool = True, weight: Incomplete | None = None + G: Graph[_Node], v=None, cutoff: bool | None = None, normalized: bool | None = True, weight: str | None = None ): ... load_centrality = newman_betweenness_centrality @_dispatchable -def edge_load_centrality(G, cutoff: bool = False): ... +def edge_load_centrality(G: Graph[_Node], cutoff: bool | None = False): ... diff --git a/stubs/networkx/networkx/algorithms/centrality/percolation.pyi b/stubs/networkx/networkx/algorithms/centrality/percolation.pyi index b64230f68108..b9124b5e7a0a 100644 --- a/stubs/networkx/networkx/algorithms/centrality/percolation.pyi +++ b/stubs/networkx/networkx/algorithms/centrality/percolation.pyi @@ -1,8 +1,12 @@ -from _typeshed import Incomplete +from _typeshed import Incomplete, SupportsGetItem +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable def percolation_centrality( - G, attribute: str = "percolation", states: Incomplete | None = None, weight: Incomplete | None = None + G: Graph[_Node], + attribute: str | None = "percolation", + states: SupportsGetItem[Incomplete, Incomplete] | None = None, + weight: str | None = None, ): ... diff --git a/stubs/networkx/networkx/algorithms/centrality/reaching.pyi b/stubs/networkx/networkx/algorithms/centrality/reaching.pyi index 4cb0a9ef7a59..b2a1a2a0deeb 100644 --- a/stubs/networkx/networkx/algorithms/centrality/reaching.pyi +++ b/stubs/networkx/networkx/algorithms/centrality/reaching.pyi @@ -1,10 +1,16 @@ -from _typeshed import Incomplete +from _typeshed import Incomplete, SupportsGetItem +from networkx.classes.digraph import DiGraph +from networkx.classes.graph import _Node from networkx.utils.backends import _dispatchable @_dispatchable -def global_reaching_centrality(G, weight: Incomplete | None = None, normalized: bool = True): ... +def global_reaching_centrality(G: DiGraph[_Node], weight: str | None = None, normalized: bool | None = True): ... @_dispatchable def local_reaching_centrality( - G, v, paths: Incomplete | None = None, weight: Incomplete | None = None, normalized: bool = True + G: DiGraph[_Node], + v: _Node, + paths: SupportsGetItem[Incomplete, Incomplete] | None = None, + weight: str | None = None, + normalized: bool | None = True, ): ... diff --git a/stubs/networkx/networkx/algorithms/centrality/second_order.pyi b/stubs/networkx/networkx/algorithms/centrality/second_order.pyi index 32f37fabeabf..df8b706360c8 100644 --- a/stubs/networkx/networkx/algorithms/centrality/second_order.pyi +++ b/stubs/networkx/networkx/algorithms/centrality/second_order.pyi @@ -1,4 +1,5 @@ +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def second_order_centrality(G): ... +def second_order_centrality(G: Graph[_Node], weight: str | None = "weight"): ... diff --git a/stubs/networkx/networkx/algorithms/centrality/subgraph_alg.pyi b/stubs/networkx/networkx/algorithms/centrality/subgraph_alg.pyi index f826a0b38022..4035e39ea41d 100644 --- a/stubs/networkx/networkx/algorithms/centrality/subgraph_alg.pyi +++ b/stubs/networkx/networkx/algorithms/centrality/subgraph_alg.pyi @@ -1,10 +1,11 @@ +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def subgraph_centrality_exp(G): ... +def subgraph_centrality_exp(G: Graph[_Node]): ... @_dispatchable -def subgraph_centrality(G): ... +def subgraph_centrality(G: Graph[_Node]): ... @_dispatchable -def communicability_betweenness_centrality(G): ... +def communicability_betweenness_centrality(G: Graph[_Node]): ... @_dispatchable -def estrada_index(G): ... +def estrada_index(G: Graph[_Node]): ... diff --git a/stubs/networkx/networkx/algorithms/centrality/trophic.pyi b/stubs/networkx/networkx/algorithms/centrality/trophic.pyi index efbd8e54f2a6..654ecef945be 100644 --- a/stubs/networkx/networkx/algorithms/centrality/trophic.pyi +++ b/stubs/networkx/networkx/algorithms/centrality/trophic.pyi @@ -1,8 +1,10 @@ +from networkx.classes.digraph import DiGraph +from networkx.classes.graph import _Node from networkx.utils.backends import _dispatchable @_dispatchable -def trophic_levels(G, weight: str = "weight"): ... +def trophic_levels(G: DiGraph[_Node], weight="weight"): ... @_dispatchable -def trophic_differences(G, weight: str = "weight"): ... +def trophic_differences(G: DiGraph[_Node], weight="weight"): ... @_dispatchable -def trophic_incoherence_parameter(G, weight: str = "weight", cannibalism: bool = False): ... +def trophic_incoherence_parameter(G: DiGraph[_Node], weight="weight", cannibalism: bool = False): ... diff --git a/stubs/networkx/networkx/algorithms/centrality/voterank_alg.pyi b/stubs/networkx/networkx/algorithms/centrality/voterank_alg.pyi index c25d90ce7ea2..c313b9c8e60d 100644 --- a/stubs/networkx/networkx/algorithms/centrality/voterank_alg.pyi +++ b/stubs/networkx/networkx/algorithms/centrality/voterank_alg.pyi @@ -1,6 +1,5 @@ -from _typeshed import Incomplete - +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def voterank(G, number_of_nodes: Incomplete | None = None): ... +def voterank(G: Graph[_Node], number_of_nodes: int | None = None): ... diff --git a/stubs/networkx/networkx/algorithms/chordal.pyi b/stubs/networkx/networkx/algorithms/chordal.pyi index ba37c5b35b58..264e5c769a5d 100644 --- a/stubs/networkx/networkx/algorithms/chordal.pyi +++ b/stubs/networkx/networkx/algorithms/chordal.pyi @@ -1,5 +1,5 @@ import sys -from collections.abc import Generator, Hashable +from collections.abc import Generator from networkx.classes.graph import Graph, _Node from networkx.exception import NetworkXException @@ -8,10 +8,10 @@ from networkx.utils.backends import _dispatchable class NetworkXTreewidthBoundExceeded(NetworkXException): ... @_dispatchable -def is_chordal(G: Graph[Hashable]) -> bool: ... +def is_chordal(G: Graph[_Node]) -> bool: ... @_dispatchable def find_induced_nodes(G: Graph[_Node], s: _Node, t: _Node, treewidth_bound: float = sys.maxsize) -> set[_Node]: ... @_dispatchable def chordal_graph_cliques(G: Graph[_Node]) -> Generator[frozenset[_Node], None, None]: ... @_dispatchable -def chordal_graph_treewidth(G: Graph[Hashable]) -> int: ... +def chordal_graph_treewidth(G: Graph[_Node]) -> int: ... diff --git a/stubs/networkx/networkx/algorithms/clique.pyi b/stubs/networkx/networkx/algorithms/clique.pyi index e7409ca915d8..72af1e40f811 100644 --- a/stubs/networkx/networkx/algorithms/clique.pyi +++ b/stubs/networkx/networkx/algorithms/clique.pyi @@ -1,5 +1,5 @@ -from _typeshed import SupportsGetItem, Unused -from collections.abc import Generator, Iterable, Iterator, Sized +from _typeshed import Incomplete +from collections.abc import Generator, Iterable, Iterator from typing import overload from networkx.classes.graph import Graph, _Node @@ -8,23 +8,18 @@ from networkx.utils.backends import _dispatchable @_dispatchable def enumerate_all_cliques(G: Graph[_Node]) -> Generator[list[_Node], None, None]: ... @_dispatchable -def find_cliques(G: Graph[_Node], nodes: SupportsGetItem[slice, _Node] | None = None) -> Generator[list[_Node], None, None]: ... +def find_cliques(G: Graph[_Node], nodes: Iterable[Incomplete] | None = None) -> Generator[list[_Node], None, None]: ... @_dispatchable -def find_cliques_recursive(G: Graph[_Node], nodes: SupportsGetItem[slice, _Node] | None = None) -> Iterator[list[_Node]]: ... +def find_cliques_recursive(G: Graph[_Node], nodes: Iterable[Incomplete] | None = None) -> Iterator[list[_Node]]: ... @_dispatchable -def make_max_clique_graph(G: Graph[_Node], create_using: type[Graph[_Node]] | None = None) -> Graph[_Node]: ... +def make_max_clique_graph(G: Graph[_Node], create_using: Graph[_Node] | None = None) -> Graph[_Node]: ... @_dispatchable def make_clique_bipartite( - G: Graph[_Node], fpos: Unused = None, create_using: type[Graph[_Node]] | None = None, name: Unused = None + G: Graph[_Node], fpos: bool | None = None, create_using: Graph[_Node] | None = None, name=None ) -> Graph[_Node]: ... @overload -def node_clique_number( # type: ignore[misc] # Incompatible return types - G: Graph[_Node], - nodes: Iterable[_Node] | None = None, - cliques: Iterable[Iterable[_Node]] | None = None, - separate_nodes: Unused = False, +def node_clique_number( + G: Graph[_Node], nodes=None, cliques: Iterable[Incomplete] | None = None, separate_nodes=False ) -> dict[_Node, int]: ... @overload -def node_clique_number( - G: Graph[_Node], nodes: _Node, cliques: Iterable[Sized] | None = None, separate_nodes: Unused = False -) -> int: ... +def node_clique_number(G: Graph[_Node], nodes=None, cliques: Iterable[Incomplete] | None = None, separate_nodes=False) -> int: ... diff --git a/stubs/networkx/networkx/algorithms/cluster.pyi b/stubs/networkx/networkx/algorithms/cluster.pyi index d0dc06de3ce9..4558712c7761 100644 --- a/stubs/networkx/networkx/algorithms/cluster.pyi +++ b/stubs/networkx/networkx/algorithms/cluster.pyi @@ -1,16 +1,19 @@ -from _typeshed import Incomplete +from collections.abc import Iterable +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def triangles(G, nodes: Incomplete | None = None): ... +def triangles(G: Graph[_Node], nodes=None): ... @_dispatchable -def average_clustering(G, nodes: Incomplete | None = None, weight: Incomplete | None = None, count_zeros: bool = True): ... +def average_clustering( + G: Graph[_Node], nodes: Iterable[_Node] | None = None, weight: str | None = None, count_zeros: bool = True +): ... @_dispatchable -def clustering(G, nodes: Incomplete | None = None, weight: Incomplete | None = None): ... +def clustering(G: Graph[_Node], nodes=None, weight: str | None = None): ... @_dispatchable -def transitivity(G): ... +def transitivity(G: Graph[_Node]): ... @_dispatchable -def square_clustering(G, nodes: Incomplete | None = None): ... +def square_clustering(G: Graph[_Node], nodes: Iterable[_Node] | None = None): ... @_dispatchable -def generalized_degree(G, nodes: Incomplete | None = None): ... +def generalized_degree(G: Graph[_Node], nodes: Iterable[_Node] | None = None): ... diff --git a/stubs/networkx/networkx/algorithms/coloring/equitable_coloring.pyi b/stubs/networkx/networkx/algorithms/coloring/equitable_coloring.pyi index 94f61af53c5b..488bcd7fa6ba 100644 --- a/stubs/networkx/networkx/algorithms/coloring/equitable_coloring.pyi +++ b/stubs/networkx/networkx/algorithms/coloring/equitable_coloring.pyi @@ -1,4 +1,5 @@ +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def equitable_color(G, num_colors): ... +def equitable_color(G: Graph[_Node], num_colors): ... diff --git a/stubs/networkx/networkx/algorithms/coloring/greedy_coloring.pyi b/stubs/networkx/networkx/algorithms/coloring/greedy_coloring.pyi index 26b8767083d0..0ce06b531e84 100644 --- a/stubs/networkx/networkx/algorithms/coloring/greedy_coloring.pyi +++ b/stubs/networkx/networkx/algorithms/coloring/greedy_coloring.pyi @@ -1,6 +1,7 @@ from _typeshed import Incomplete from collections.abc import Generator +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable __all__ = [ @@ -32,23 +33,4 @@ def strategy_connected_sequential(G, colors, traversal: str = "bfs") -> Generato @_dispatchable def strategy_saturation_largest_first(G, colors) -> Generator[Incomplete, None, Incomplete]: ... @_dispatchable -def greedy_color(G, strategy: str = "largest_first", interchange: bool = False): ... - -class _Node: - node_id: Incomplete - color: int - adj_list: Incomplete - adj_color: Incomplete - def __init__(self, node_id, n) -> None: ... - def assign_color(self, adj_entry, color) -> None: ... - def clear_color(self, adj_entry, color) -> None: ... - def iter_neighbors(self) -> Generator[Incomplete, None, None]: ... - def iter_neighbors_color(self, color) -> Generator[Incomplete, None, None]: ... - -class _AdjEntry: - node_id: Incomplete - next: Incomplete - mate: Incomplete - col_next: Incomplete - col_prev: Incomplete - def __init__(self, node_id) -> None: ... +def greedy_color(G: Graph[_Node], strategy="largest_first", interchange: bool = False): ... diff --git a/stubs/networkx/networkx/algorithms/communicability_alg.pyi b/stubs/networkx/networkx/algorithms/communicability_alg.pyi index 9eede08f8535..a36df0c93379 100644 --- a/stubs/networkx/networkx/algorithms/communicability_alg.pyi +++ b/stubs/networkx/networkx/algorithms/communicability_alg.pyi @@ -1,6 +1,7 @@ +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def communicability(G): ... +def communicability(G: Graph[_Node]): ... @_dispatchable -def communicability_exp(G): ... +def communicability_exp(G: Graph[_Node]): ... diff --git a/stubs/networkx/networkx/algorithms/community/asyn_fluid.pyi b/stubs/networkx/networkx/algorithms/community/asyn_fluid.pyi index d78fdc2db5e5..17a087cd6ce5 100644 --- a/stubs/networkx/networkx/algorithms/community/asyn_fluid.pyi +++ b/stubs/networkx/networkx/algorithms/community/asyn_fluid.pyi @@ -1,6 +1,6 @@ -from _typeshed import Incomplete - +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable +from numpy.random import RandomState @_dispatchable -def asyn_fluidc(G, k, max_iter: int = 100, seed: Incomplete | None = None): ... +def asyn_fluidc(G: Graph[_Node], k: int, max_iter: int = 100, seed: int | RandomState | None = None): ... diff --git a/stubs/networkx/networkx/algorithms/community/centrality.pyi b/stubs/networkx/networkx/algorithms/community/centrality.pyi index b6b2712c1f62..8fbd47609966 100644 --- a/stubs/networkx/networkx/algorithms/community/centrality.pyi +++ b/stubs/networkx/networkx/algorithms/community/centrality.pyi @@ -1,7 +1,10 @@ from _typeshed import Incomplete -from collections.abc import Generator +from collections.abc import Callable, Generator +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def girvan_newman(G, most_valuable_edge: Incomplete | None = None) -> Generator[Incomplete, None, Incomplete]: ... +def girvan_newman( + G: Graph[_Node], most_valuable_edge: Callable[..., Incomplete] | None = None +) -> Generator[Incomplete, None, Incomplete]: ... diff --git a/stubs/networkx/networkx/algorithms/community/community_utils.pyi b/stubs/networkx/networkx/algorithms/community/community_utils.pyi index 882dbf8ab1bf..2528f102b3b6 100644 --- a/stubs/networkx/networkx/algorithms/community/community_utils.pyi +++ b/stubs/networkx/networkx/algorithms/community/community_utils.pyi @@ -1,4 +1,5 @@ +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def is_partition(G, communities): ... +def is_partition(G: Graph[_Node], communities): ... diff --git a/stubs/networkx/networkx/algorithms/community/divisive.pyi b/stubs/networkx/networkx/algorithms/community/divisive.pyi index 6eeed32d21ab..4ae890eab5f1 100644 --- a/stubs/networkx/networkx/algorithms/community/divisive.pyi +++ b/stubs/networkx/networkx/algorithms/community/divisive.pyi @@ -1,10 +1,13 @@ from _typeshed import Incomplete import networkx as nx +from networkx.classes.graph import Graph, _Node __all__ = ["edge_betweenness_partition", "edge_current_flow_betweenness_partition"] @nx._dispatchable -def edge_betweenness_partition(G, number_of_sets: int, *, weight: Incomplete | None = None) -> list[Incomplete]: ... +def edge_betweenness_partition(G: Graph[_Node], number_of_sets: int, *, weight: str | None = None) -> list[Incomplete]: ... @nx._dispatchable -def edge_current_flow_betweenness_partition(G, number_of_sets: int, *, weight: Incomplete | None = None) -> list[Incomplete]: ... +def edge_current_flow_betweenness_partition( + G: Graph[_Node], number_of_sets: int, *, weight: str | None = None +) -> list[Incomplete]: ... diff --git a/stubs/networkx/networkx/algorithms/community/kclique.pyi b/stubs/networkx/networkx/algorithms/community/kclique.pyi index 39bc56a86fad..13c777be295e 100644 --- a/stubs/networkx/networkx/algorithms/community/kclique.pyi +++ b/stubs/networkx/networkx/algorithms/community/kclique.pyi @@ -1,7 +1,8 @@ from _typeshed import Incomplete from collections.abc import Generator +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def k_clique_communities(G, k, cliques: Incomplete | None = None) -> Generator[Incomplete, None, None]: ... +def k_clique_communities(G: Graph[_Node], k: int, cliques=None) -> Generator[Incomplete, None, None]: ... diff --git a/stubs/networkx/networkx/algorithms/community/kernighan_lin.pyi b/stubs/networkx/networkx/algorithms/community/kernighan_lin.pyi index cd15c6541079..4bb3fce53e9a 100644 --- a/stubs/networkx/networkx/algorithms/community/kernighan_lin.pyi +++ b/stubs/networkx/networkx/algorithms/community/kernighan_lin.pyi @@ -1,8 +1,14 @@ from _typeshed import Incomplete +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable +from numpy.random import RandomState @_dispatchable def kernighan_lin_bisection( - G, partition: Incomplete | None = None, max_iter: int = 10, weight: str = "weight", seed: Incomplete | None = None + G: Graph[_Node], + partition: tuple[Incomplete] | None = None, + max_iter: int = 10, + weight: str = "weight", + seed: int | RandomState | None = None, ): ... diff --git a/stubs/networkx/networkx/algorithms/community/label_propagation.pyi b/stubs/networkx/networkx/algorithms/community/label_propagation.pyi index c79a95fd2829..7679d01bc6d3 100644 --- a/stubs/networkx/networkx/algorithms/community/label_propagation.pyi +++ b/stubs/networkx/networkx/algorithms/community/label_propagation.pyi @@ -1,11 +1,13 @@ from _typeshed import Incomplete from collections.abc import Generator +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable +from numpy.random import RandomState @_dispatchable def asyn_lpa_communities( - G, weight: Incomplete | None = None, seed: Incomplete | None = None + G: Graph[_Node], weight: str | None = None, seed: int | RandomState | None = None ) -> Generator[Incomplete, Incomplete, None]: ... @_dispatchable -def label_propagation_communities(G): ... +def label_propagation_communities(G: Graph[_Node]): ... diff --git a/stubs/networkx/networkx/algorithms/community/louvain.pyi b/stubs/networkx/networkx/algorithms/community/louvain.pyi index e086829b451e..be5194a9174a 100644 --- a/stubs/networkx/networkx/algorithms/community/louvain.pyi +++ b/stubs/networkx/networkx/algorithms/community/louvain.pyi @@ -1,13 +1,24 @@ from _typeshed import Incomplete from collections.abc import Generator +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable +from numpy.random import RandomState @_dispatchable def louvain_communities( - G, weight: str = "weight", resolution: float = 1, threshold: float = 1e-07, seed: Incomplete | None = None + G: Graph[_Node], + weight: str | None = "weight", + resolution: float | None = 1, + threshold: float | None = 1e-07, + max_level: int | None = None, + seed: int | RandomState | None = None, ): ... @_dispatchable def louvain_partitions( - G, weight: str = "weight", resolution: float = 1, threshold: float = 1e-07, seed: Incomplete | None = None + G: Graph[_Node], + weight: str | None = "weight", + resolution: float | None = 1, + threshold: float | None = 1e-07, + seed: int | RandomState | None = None, ) -> Generator[Incomplete, None, None]: ... diff --git a/stubs/networkx/networkx/algorithms/community/lukes.pyi b/stubs/networkx/networkx/algorithms/community/lukes.pyi index 0044043faf7c..81a7a1335170 100644 --- a/stubs/networkx/networkx/algorithms/community/lukes.pyi +++ b/stubs/networkx/networkx/algorithms/community/lukes.pyi @@ -1,6 +1,5 @@ -from _typeshed import Incomplete - +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def lukes_partitioning(G, max_size, node_weight: Incomplete | None = None, edge_weight: Incomplete | None = None): ... +def lukes_partitioning(G: Graph[_Node], max_size: int, node_weight=None, edge_weight=None): ... diff --git a/stubs/networkx/networkx/algorithms/community/modularity_max.pyi b/stubs/networkx/networkx/algorithms/community/modularity_max.pyi index 9842451eaba9..b93dbf52033a 100644 --- a/stubs/networkx/networkx/algorithms/community/modularity_max.pyi +++ b/stubs/networkx/networkx/algorithms/community/modularity_max.pyi @@ -1,10 +1,9 @@ -from _typeshed import Incomplete - +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable def greedy_modularity_communities( - G, weight: Incomplete | None = None, resolution: float = 1, cutoff: int = 1, best_n: Incomplete | None = None + G: Graph[_Node], weight: str | None = None, resolution: float | None = 1, cutoff: int | None = 1, best_n: int | None = None ): ... @_dispatchable -def naive_greedy_modularity_communities(G, resolution: float = 1, weight: Incomplete | None = None): ... +def naive_greedy_modularity_communities(G: Graph[_Node], resolution: float = 1, weight: str | None = None): ... diff --git a/stubs/networkx/networkx/algorithms/community/quality.pyi b/stubs/networkx/networkx/algorithms/community/quality.pyi index 12f9e93f2f50..2ce826f6e83e 100644 --- a/stubs/networkx/networkx/algorithms/community/quality.pyi +++ b/stubs/networkx/networkx/algorithms/community/quality.pyi @@ -1,3 +1,4 @@ +from networkx.classes.graph import Graph, _Node from networkx.exception import NetworkXError from networkx.utils.backends import _dispatchable @@ -7,6 +8,6 @@ class NotAPartition(NetworkXError): def __init__(self, G, collection) -> None: ... @_dispatchable -def modularity(G, communities, weight: str = "weight", resolution: float = 1): ... +def modularity(G: Graph[_Node], communities, weight: str | None = "weight", resolution: float = 1): ... @_dispatchable -def partition_quality(G, partition): ... +def partition_quality(G: Graph[_Node], partition): ... diff --git a/stubs/networkx/networkx/algorithms/components/biconnected.pyi b/stubs/networkx/networkx/algorithms/components/biconnected.pyi index 1f58e5d23192..782f1c69014b 100644 --- a/stubs/networkx/networkx/algorithms/components/biconnected.pyi +++ b/stubs/networkx/networkx/algorithms/components/biconnected.pyi @@ -1,13 +1,14 @@ from _typeshed import Incomplete from collections.abc import Generator +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def is_biconnected(G): ... +def is_biconnected(G: Graph[_Node]): ... @_dispatchable -def biconnected_component_edges(G) -> Generator[Incomplete, Incomplete, None]: ... +def biconnected_component_edges(G: Graph[_Node]) -> Generator[Incomplete, Incomplete, None]: ... @_dispatchable -def biconnected_components(G) -> Generator[Incomplete, None, None]: ... +def biconnected_components(G: Graph[_Node]) -> Generator[Incomplete, None, None]: ... @_dispatchable -def articulation_points(G) -> Generator[Incomplete, None, None]: ... +def articulation_points(G: Graph[_Node]) -> Generator[Incomplete, None, None]: ... diff --git a/stubs/networkx/networkx/algorithms/components/connected.pyi b/stubs/networkx/networkx/algorithms/components/connected.pyi index 240517110407..67a380977343 100644 --- a/stubs/networkx/networkx/algorithms/components/connected.pyi +++ b/stubs/networkx/networkx/algorithms/components/connected.pyi @@ -1,13 +1,14 @@ from _typeshed import Incomplete from collections.abc import Generator +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def connected_components(G) -> Generator[Incomplete, None, None]: ... +def connected_components(G: Graph[_Node]) -> Generator[Incomplete, None, None]: ... @_dispatchable -def number_connected_components(G): ... +def number_connected_components(G: Graph[_Node]): ... @_dispatchable -def is_connected(G): ... +def is_connected(G: Graph[_Node]): ... @_dispatchable -def node_connected_component(G, n): ... +def node_connected_component(G: Graph[_Node], n: str): ... diff --git a/stubs/networkx/networkx/algorithms/components/semiconnected.pyi b/stubs/networkx/networkx/algorithms/components/semiconnected.pyi index 2a65d32221aa..178a602e4e47 100644 --- a/stubs/networkx/networkx/algorithms/components/semiconnected.pyi +++ b/stubs/networkx/networkx/algorithms/components/semiconnected.pyi @@ -1,6 +1,5 @@ -from _typeshed import Incomplete - +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def is_semiconnected(G, topo_order: Incomplete | None = None): ... +def is_semiconnected(G: Graph[_Node]): ... diff --git a/stubs/networkx/networkx/algorithms/components/strongly_connected.pyi b/stubs/networkx/networkx/algorithms/components/strongly_connected.pyi index 93d76806aed3..4747f4950e01 100644 --- a/stubs/networkx/networkx/algorithms/components/strongly_connected.pyi +++ b/stubs/networkx/networkx/algorithms/components/strongly_connected.pyi @@ -1,4 +1,4 @@ -from collections.abc import Generator, Hashable, Iterable +from collections.abc import Generator from networkx.classes.digraph import DiGraph from networkx.classes.graph import Graph, _Node @@ -7,10 +7,10 @@ from networkx.utils.backends import _dispatchable @_dispatchable def strongly_connected_components(G: Graph[_Node]) -> Generator[set[_Node], None, None]: ... @_dispatchable -def kosaraju_strongly_connected_components(G: Graph[_Node], source: _Node | None = None) -> Generator[set[_Node], None, None]: ... +def kosaraju_strongly_connected_components(G: Graph[_Node], source=None) -> Generator[set[_Node], None, None]: ... @_dispatchable -def number_strongly_connected_components(G: Graph[Hashable]) -> int: ... +def number_strongly_connected_components(G: Graph[_Node]) -> int: ... @_dispatchable -def is_strongly_connected(G: Graph[Hashable]) -> bool: ... +def is_strongly_connected(G: Graph[_Node]) -> bool: ... @_dispatchable -def condensation(G: DiGraph[_Node], scc: Iterable[Iterable[_Node]] | None = None) -> DiGraph[int]: ... +def condensation(G: DiGraph[_Node], scc=None) -> DiGraph[int]: ... diff --git a/stubs/networkx/networkx/algorithms/components/weakly_connected.pyi b/stubs/networkx/networkx/algorithms/components/weakly_connected.pyi index 66c4f7b61dfe..84cccf2f0250 100644 --- a/stubs/networkx/networkx/algorithms/components/weakly_connected.pyi +++ b/stubs/networkx/networkx/algorithms/components/weakly_connected.pyi @@ -1,4 +1,4 @@ -from collections.abc import Generator, Hashable +from collections.abc import Generator from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @@ -6,6 +6,6 @@ from networkx.utils.backends import _dispatchable @_dispatchable def weakly_connected_components(G: Graph[_Node]) -> Generator[set[_Node], None, None]: ... @_dispatchable -def number_weakly_connected_components(G: Graph[Hashable]) -> int: ... +def number_weakly_connected_components(G: Graph[_Node]) -> int: ... @_dispatchable -def is_weakly_connected(G: Graph[Hashable]) -> bool: ... +def is_weakly_connected(G: Graph[_Node]) -> bool: ... diff --git a/stubs/networkx/networkx/algorithms/connectivity/connectivity.pyi b/stubs/networkx/networkx/algorithms/connectivity/connectivity.pyi index a13069989845..8060b1e332c0 100644 --- a/stubs/networkx/networkx/algorithms/connectivity/connectivity.pyi +++ b/stubs/networkx/networkx/algorithms/connectivity/connectivity.pyi @@ -1,6 +1,9 @@ from _typeshed import Incomplete +from collections.abc import Callable, Iterable from networkx.algorithms.flow import edmonds_karp +from networkx.classes.digraph import DiGraph +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable __all__ = [ @@ -11,40 +14,43 @@ __all__ = [ "edge_connectivity", "all_pairs_node_connectivity", ] - default_flow_func = edmonds_karp @_dispatchable def local_node_connectivity( - G, - s, - t, - flow_func: Incomplete | None = None, - auxiliary: Incomplete | None = None, - residual: Incomplete | None = None, - cutoff: Incomplete | None = None, + G: Graph[_Node], + s: _Node, + t: _Node, + flow_func: Callable[..., Incomplete] | None = None, + auxiliary: DiGraph[_Node] | None = None, + residual: DiGraph[_Node] | None = None, + cutoff: float | None = None, ): ... @_dispatchable -def node_connectivity(G, s: Incomplete | None = None, t: Incomplete | None = None, flow_func: Incomplete | None = None): ... +def node_connectivity( + G: Graph[_Node], s: _Node | None = None, t: _Node | None = None, flow_func: Callable[..., Incomplete] | None = None +): ... @_dispatchable -def average_node_connectivity(G, flow_func: Incomplete | None = None): ... +def average_node_connectivity(G: Graph[_Node], flow_func: Callable[..., Incomplete] | None = None): ... @_dispatchable -def all_pairs_node_connectivity(G, nbunch: Incomplete | None = None, flow_func: Incomplete | None = None): ... +def all_pairs_node_connectivity( + G: Graph[_Node], nbunch: Iterable[Incomplete] | None = None, flow_func: Callable[..., Incomplete] | None = None +): ... @_dispatchable def local_edge_connectivity( - G, - s, - t, - flow_func: Incomplete | None = None, - auxiliary: Incomplete | None = None, - residual: Incomplete | None = None, - cutoff: Incomplete | None = None, + G: Graph[_Node], + s: _Node, + t: _Node, + flow_func: Callable[..., Incomplete] | None = None, + auxiliary: DiGraph[_Node] | None = None, + residual: DiGraph[_Node] | None = None, + cutoff: float | None = None, ): ... @_dispatchable def edge_connectivity( - G, - s: Incomplete | None = None, - t: Incomplete | None = None, - flow_func: Incomplete | None = None, - cutoff: Incomplete | None = None, + G: Graph[_Node], + s: _Node | None = None, + t: _Node | None = None, + flow_func: Callable[..., Incomplete] | None = None, + cutoff: float | None = None, ): ... diff --git a/stubs/networkx/networkx/algorithms/connectivity/cuts.pyi b/stubs/networkx/networkx/algorithms/connectivity/cuts.pyi index 44372c2d915c..d9c41c57195d 100644 --- a/stubs/networkx/networkx/algorithms/connectivity/cuts.pyi +++ b/stubs/networkx/networkx/algorithms/connectivity/cuts.pyi @@ -1,21 +1,37 @@ from _typeshed import Incomplete +from collections.abc import Callable from networkx.algorithms.flow import edmonds_karp +from networkx.classes.digraph import DiGraph +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable __all__ = ["minimum_st_node_cut", "minimum_node_cut", "minimum_st_edge_cut", "minimum_edge_cut"] - default_flow_func = edmonds_karp @_dispatchable def minimum_st_edge_cut( - G, s, t, flow_func: Incomplete | None = None, auxiliary: Incomplete | None = None, residual: Incomplete | None = None + G: Graph[_Node], + s: _Node, + t: _Node, + flow_func: Callable[..., Incomplete] | None = None, + auxiliary: DiGraph[_Node] | None = None, + residual: DiGraph[_Node] | None = None, ): ... @_dispatchable def minimum_st_node_cut( - G, s, t, flow_func: Incomplete | None = None, auxiliary: Incomplete | None = None, residual: Incomplete | None = None + G: Graph[_Node], + s: _Node, + t: _Node, + flow_func: Callable[..., Incomplete] | None = None, + auxiliary: DiGraph[_Node] | None = None, + residual: DiGraph[_Node] | None = None, ): ... @_dispatchable -def minimum_node_cut(G, s: Incomplete | None = None, t: Incomplete | None = None, flow_func: Incomplete | None = None): ... +def minimum_node_cut( + G: Graph[_Node], s: _Node | None = None, t: _Node | None = None, flow_func: Callable[..., Incomplete] | None = None +): ... @_dispatchable -def minimum_edge_cut(G, s: Incomplete | None = None, t: Incomplete | None = None, flow_func: Incomplete | None = None): ... +def minimum_edge_cut( + G: Graph[_Node], s: _Node | None = None, t: _Node | None = None, flow_func: Callable[..., Incomplete] | None = None +): ... diff --git a/stubs/networkx/networkx/algorithms/connectivity/disjoint_paths.pyi b/stubs/networkx/networkx/algorithms/connectivity/disjoint_paths.pyi index 2f8fc3abe242..254973fa6a68 100644 --- a/stubs/networkx/networkx/algorithms/connectivity/disjoint_paths.pyi +++ b/stubs/networkx/networkx/algorithms/connectivity/disjoint_paths.pyi @@ -1,30 +1,31 @@ from _typeshed import Incomplete -from collections.abc import Generator +from collections.abc import Callable, Generator from networkx.algorithms.flow import edmonds_karp +from networkx.classes.digraph import DiGraph +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable __all__ = ["edge_disjoint_paths", "node_disjoint_paths"] - default_flow_func = edmonds_karp @_dispatchable def edge_disjoint_paths( - G, - s, - t, - flow_func: Incomplete | None = None, - cutoff: Incomplete | None = None, - auxiliary: Incomplete | None = None, - residual: Incomplete | None = None, + G: Graph[_Node], + s: _Node, + t: _Node, + flow_func: Callable[..., Incomplete] | None = None, + cutoff: int | None = None, + auxiliary: DiGraph[_Node] | None = None, + residual: DiGraph[_Node] | None = None, ) -> Generator[Incomplete, None, None]: ... @_dispatchable def node_disjoint_paths( - G, - s, - t, - flow_func: Incomplete | None = None, - cutoff: Incomplete | None = None, - auxiliary: Incomplete | None = None, - residual: Incomplete | None = None, + G: Graph[_Node], + s: _Node, + t: _Node, + flow_func: Callable[..., Incomplete] | None = None, + cutoff: int | None = None, + auxiliary: DiGraph[_Node] | None = None, + residual: DiGraph[_Node] | None = None, ) -> Generator[Incomplete, None, None]: ... diff --git a/stubs/networkx/networkx/algorithms/connectivity/edge_augmentation.pyi b/stubs/networkx/networkx/algorithms/connectivity/edge_augmentation.pyi index fe32ff99d112..de9d9d64763b 100644 --- a/stubs/networkx/networkx/algorithms/connectivity/edge_augmentation.pyi +++ b/stubs/networkx/networkx/algorithms/connectivity/edge_augmentation.pyi @@ -1,17 +1,18 @@ -from collections.abc import Generator, Hashable +from _typeshed import SupportsGetItem +from collections.abc import Generator from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def is_k_edge_connected(G: Graph[Hashable], k: int): ... +def is_k_edge_connected(G: Graph[_Node], k: int): ... @_dispatchable -def is_locally_k_edge_connected(G, s, t, k): ... +def is_locally_k_edge_connected(G: Graph[_Node], s: _Node, t: _Node, k: int): ... @_dispatchable def k_edge_augmentation( G: Graph[_Node], k: int, - avail: tuple[_Node, _Node] | tuple[_Node, _Node, dict[str, int]] | None = None, + avail: set[tuple[int, int]] | set[tuple[int, int, float]] | SupportsGetItem[tuple[int, int], float] | None = None, weight: str | None = None, partial: bool = False, ) -> Generator[tuple[_Node, _Node], None, None]: ... diff --git a/stubs/networkx/networkx/algorithms/connectivity/edge_kcomponents.pyi b/stubs/networkx/networkx/algorithms/connectivity/edge_kcomponents.pyi index 2578606fb13f..67927d5cb64a 100644 --- a/stubs/networkx/networkx/algorithms/connectivity/edge_kcomponents.pyi +++ b/stubs/networkx/networkx/algorithms/connectivity/edge_kcomponents.pyi @@ -1,19 +1,21 @@ from _typeshed import Incomplete from collections.abc import Generator +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def k_edge_components(G, k): ... +def k_edge_components(G: Graph[_Node], k: int): ... @_dispatchable -def k_edge_subgraphs(G, k): ... +def k_edge_subgraphs(G: Graph[_Node], k: int): ... @_dispatchable -def bridge_components(G) -> Generator[Incomplete, Incomplete, None]: ... +def bridge_components(G: Graph[_Node]) -> Generator[Incomplete, Incomplete, None]: ... class EdgeComponentAuxGraph: A: Incomplete H: Incomplete + @classmethod def construct(cls, G): ... - def k_edge_components(self, k) -> Generator[Incomplete, Incomplete, None]: ... - def k_edge_subgraphs(self, k) -> Generator[Incomplete, Incomplete, None]: ... + def k_edge_components(self, k: int) -> Generator[Incomplete, Incomplete, None]: ... + def k_edge_subgraphs(self, k: int) -> Generator[Incomplete, Incomplete, None]: ... diff --git a/stubs/networkx/networkx/algorithms/connectivity/kcomponents.pyi b/stubs/networkx/networkx/algorithms/connectivity/kcomponents.pyi index ee074a6a682d..32010e9ed331 100644 --- a/stubs/networkx/networkx/algorithms/connectivity/kcomponents.pyi +++ b/stubs/networkx/networkx/algorithms/connectivity/kcomponents.pyi @@ -1,11 +1,12 @@ from _typeshed import Incomplete +from collections.abc import Callable from networkx.algorithms.flow import edmonds_karp +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable __all__ = ["k_components"] - default_flow_func = edmonds_karp @_dispatchable -def k_components(G, flow_func: Incomplete | None = None): ... +def k_components(G: Graph[_Node], flow_func: Callable[..., Incomplete] | None = None): ... diff --git a/stubs/networkx/networkx/algorithms/connectivity/kcutsets.pyi b/stubs/networkx/networkx/algorithms/connectivity/kcutsets.pyi index 8f527058659c..78b0cb1befbf 100644 --- a/stubs/networkx/networkx/algorithms/connectivity/kcutsets.pyi +++ b/stubs/networkx/networkx/algorithms/connectivity/kcutsets.pyi @@ -1,12 +1,14 @@ from _typeshed import Incomplete -from collections.abc import Generator +from collections.abc import Callable, Generator from networkx.algorithms.flow import edmonds_karp +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable __all__ = ["all_node_cuts"] - default_flow_func = edmonds_karp @_dispatchable -def all_node_cuts(G, k: Incomplete | None = None, flow_func: Incomplete | None = None) -> Generator[Incomplete, None, None]: ... +def all_node_cuts( + G: Graph[_Node], k: int | None = None, flow_func: Callable[..., Incomplete] | None = None +) -> Generator[Incomplete, None, None]: ... diff --git a/stubs/networkx/networkx/algorithms/connectivity/stoerwagner.pyi b/stubs/networkx/networkx/algorithms/connectivity/stoerwagner.pyi index 1bd01705dec3..c0b8cd3a733c 100644 --- a/stubs/networkx/networkx/algorithms/connectivity/stoerwagner.pyi +++ b/stubs/networkx/networkx/algorithms/connectivity/stoerwagner.pyi @@ -1,4 +1,5 @@ +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def stoer_wagner(G, weight: str = "weight", heap=...): ... +def stoer_wagner(G: Graph[_Node], weight: str = "weight", heap: type = ...): ... diff --git a/stubs/networkx/networkx/algorithms/core.pyi b/stubs/networkx/networkx/algorithms/core.pyi index 44bde570425a..401797dc8be1 100644 --- a/stubs/networkx/networkx/algorithms/core.pyi +++ b/stubs/networkx/networkx/algorithms/core.pyi @@ -1,18 +1,19 @@ -from _typeshed import Incomplete +from _typeshed import Incomplete, SupportsGetItem +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def core_number(G): ... +def core_number(G: Graph[_Node]): ... @_dispatchable -def k_core(G, k: Incomplete | None = None, core_number: Incomplete | None = None): ... +def k_core(G: Graph[_Node], k: int | None = None, core_number: SupportsGetItem[Incomplete, Incomplete] | None = None): ... @_dispatchable -def k_shell(G, k: Incomplete | None = None, core_number: Incomplete | None = None): ... +def k_shell(G: Graph[_Node], k: int | None = None, core_number: SupportsGetItem[Incomplete, Incomplete] | None = None): ... @_dispatchable -def k_crust(G, k: Incomplete | None = None, core_number: Incomplete | None = None): ... +def k_crust(G: Graph[_Node], k: int | None = None, core_number: SupportsGetItem[Incomplete, Incomplete] | None = None): ... @_dispatchable -def k_corona(G, k, core_number: Incomplete | None = None): ... +def k_corona(G: Graph[_Node], k: int, core_number: SupportsGetItem[Incomplete, Incomplete] | None = None): ... @_dispatchable -def k_truss(G, k): ... +def k_truss(G: Graph[_Node], k: int): ... @_dispatchable -def onion_layers(G): ... +def onion_layers(G: Graph[_Node]): ... diff --git a/stubs/networkx/networkx/algorithms/covering.pyi b/stubs/networkx/networkx/algorithms/covering.pyi index 8b50c52a1b37..0680bbc27e41 100644 --- a/stubs/networkx/networkx/algorithms/covering.pyi +++ b/stubs/networkx/networkx/algorithms/covering.pyi @@ -1,8 +1,10 @@ from _typeshed import Incomplete +from collections.abc import Callable +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def min_edge_cover(G, matching_algorithm: Incomplete | None = None): ... +def min_edge_cover(G: Graph[_Node], matching_algorithm: Callable[..., Incomplete] | None = None): ... @_dispatchable -def is_edge_cover(G, cover): ... +def is_edge_cover(G: Graph[_Node], cover: set[Incomplete]): ... diff --git a/stubs/networkx/networkx/algorithms/cuts.pyi b/stubs/networkx/networkx/algorithms/cuts.pyi index 11ef7637a259..4f3e3474b5b9 100644 --- a/stubs/networkx/networkx/algorithms/cuts.pyi +++ b/stubs/networkx/networkx/algorithms/cuts.pyi @@ -1,20 +1,21 @@ -from _typeshed import Incomplete +from collections.abc import Iterable +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def cut_size(G, S, T: Incomplete | None = None, weight: Incomplete | None = None): ... +def cut_size(G: Graph[_Node], S: Iterable[_Node], T: Iterable[_Node] | None = None, weight: str | None = None): ... @_dispatchable -def volume(G, S, weight: Incomplete | None = None): ... +def volume(G: Graph[_Node], S: Iterable[_Node], weight: str | None = None): ... @_dispatchable -def normalized_cut_size(G, S, T: Incomplete | None = None, weight: Incomplete | None = None): ... +def normalized_cut_size(G: Graph[_Node], S: Iterable[_Node], T: Iterable[_Node] | None = None, weight: str | None = None): ... @_dispatchable -def conductance(G, S, T: Incomplete | None = None, weight: Incomplete | None = None): ... +def conductance(G: Graph[_Node], S: Iterable[_Node], T: Iterable[_Node] | None = None, weight: str | None = None): ... @_dispatchable -def edge_expansion(G, S, T: Incomplete | None = None, weight: Incomplete | None = None): ... +def edge_expansion(G: Graph[_Node], S: Iterable[_Node], T: Iterable[_Node] | None = None, weight: str | None = None): ... @_dispatchable -def mixing_expansion(G, S, T: Incomplete | None = None, weight: Incomplete | None = None): ... +def mixing_expansion(G: Graph[_Node], S: Iterable[_Node], T: Iterable[_Node] | None = None, weight: str | None = None): ... @_dispatchable -def node_expansion(G, S): ... +def node_expansion(G: Graph[_Node], S: Iterable[_Node]): ... @_dispatchable -def boundary_expansion(G, S): ... +def boundary_expansion(G: Graph[_Node], S: Iterable[_Node]): ... diff --git a/stubs/networkx/networkx/algorithms/cycles.pyi b/stubs/networkx/networkx/algorithms/cycles.pyi index 8236680f3f05..9f8b887516e7 100644 --- a/stubs/networkx/networkx/algorithms/cycles.pyi +++ b/stubs/networkx/networkx/algorithms/cycles.pyi @@ -1,23 +1,26 @@ from _typeshed import Incomplete from collections.abc import Generator +from networkx.classes.digraph import DiGraph +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def cycle_basis(G, root: Incomplete | None = None): ... +def cycle_basis(G: Graph[_Node], root: _Node | None = None): ... @_dispatchable -def simple_cycles(G, length_bound: Incomplete | None = None) -> Generator[Incomplete, Incomplete, None]: ... +def simple_cycles(G: Graph[_Node], length_bound: int | None = None) -> Generator[Incomplete, Incomplete, None]: ... class _NeighborhoodCache(dict[Incomplete, Incomplete]): G: Incomplete + def __init__(self, G) -> None: ... def __missing__(self, v): ... @_dispatchable -def chordless_cycles(G, length_bound: Incomplete | None = None) -> Generator[Incomplete, Incomplete, None]: ... +def chordless_cycles(G: DiGraph[_Node], length_bound: int | None = None) -> Generator[Incomplete, Incomplete, None]: ... @_dispatchable -def recursive_simple_cycles(G): ... +def recursive_simple_cycles(G: DiGraph[_Node]): ... @_dispatchable -def find_cycle(G, source: Incomplete | None = None, orientation: Incomplete | None = None): ... +def find_cycle(G: Graph[_Node], source=None, orientation=None): ... @_dispatchable -def minimum_cycle_basis(G, weight: Incomplete | None = None): ... +def minimum_cycle_basis(G: Graph[_Node], weight: str | None = None): ... diff --git a/stubs/networkx/networkx/algorithms/d_separation.pyi b/stubs/networkx/networkx/algorithms/d_separation.pyi index c672127feb42..e1eb575409fd 100644 --- a/stubs/networkx/networkx/algorithms/d_separation.pyi +++ b/stubs/networkx/networkx/algorithms/d_separation.pyi @@ -1,3 +1,5 @@ +from networkx.classes.digraph import DiGraph +from networkx.classes.graph import _Node from networkx.utils.backends import _dispatchable @_dispatchable @@ -5,4 +7,4 @@ def d_separated(G, x, y, z): ... @_dispatchable def minimal_d_separator(G, u, v): ... @_dispatchable -def is_minimal_d_separator(G, u, v, z): ... +def is_minimal_d_separator(G: DiGraph[_Node], x, y, z, *, included=None, restricted=None): ... diff --git a/stubs/networkx/networkx/algorithms/dag.pyi b/stubs/networkx/networkx/algorithms/dag.pyi index b85fff5cb09b..07c3b3deff43 100644 --- a/stubs/networkx/networkx/algorithms/dag.pyi +++ b/stubs/networkx/networkx/algorithms/dag.pyi @@ -1,14 +1,14 @@ -from _typeshed import SupportsRichComparison -from collections.abc import Callable, Generator, Iterable, Reversible +from _typeshed import Incomplete +from collections.abc import Callable, Generator, Iterable from networkx.classes.digraph import DiGraph from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def descendants(G: Graph[_Node], source: _Node) -> set[_Node]: ... +def descendants(G: Graph[_Node], source) -> set[_Node]: ... @_dispatchable -def ancestors(G: Graph[_Node], source: _Node) -> set[_Node]: ... +def ancestors(G: Graph[_Node], source) -> set[_Node]: ... @_dispatchable def is_directed_acyclic_graph(G: Graph[_Node]) -> bool: ... @_dispatchable @@ -17,25 +17,28 @@ def topological_generations(G: DiGraph[_Node]) -> Generator[list[_Node], None, N def topological_sort(G: DiGraph[_Node]) -> Generator[_Node, None, None]: ... @_dispatchable def lexicographical_topological_sort( - G: DiGraph[_Node], key: Callable[[_Node], SupportsRichComparison] | None = None + G: DiGraph[_Node], key: Callable[..., Incomplete] | None = None ) -> Generator[_Node, None, None]: ... @_dispatchable def all_topological_sorts(G: DiGraph[_Node]) -> Generator[list[_Node], None, None]: ... @_dispatchable def is_aperiodic(G: DiGraph[_Node]) -> bool: ... @_dispatchable -def transitive_closure(G: Graph[_Node], reflexive: bool = False) -> Graph[_Node]: ... +def transitive_closure(G: Graph[_Node], reflexive=False) -> Graph[_Node]: ... @_dispatchable -def transitive_closure_dag(G: DiGraph[_Node], reflexive: bool = False) -> DiGraph[_Node]: ... +def transitive_closure_dag(G: DiGraph[_Node], topo_order: Iterable[Incomplete] | None = None) -> DiGraph[_Node]: ... @_dispatchable def transitive_reduction(G: DiGraph[_Node]) -> DiGraph[_Node]: ... @_dispatchable -def antichains(G: DiGraph[_Node], topo_order: Reversible[_Node] | None = None) -> Generator[list[_Node], None, None]: ... +def antichains(G: DiGraph[_Node], topo_order: Iterable[Incomplete] | None = None) -> Generator[list[_Node], None, None]: ... @_dispatchable def dag_longest_path( - G: DiGraph[_Node], weight: str = "weight", default_weight: int = 1, topo_order: Iterable[_Node] | None = None + G: DiGraph[_Node], + weight: str | None = "weight", + default_weight: int | None = 1, + topo_order: Iterable[Incomplete] | None = None, ) -> list[_Node]: ... @_dispatchable -def dag_longest_path_length(G: DiGraph[_Node], weight: str = "weight", default_weight: int = 1) -> int: ... +def dag_longest_path_length(G: DiGraph[_Node], weight: str | None = "weight", default_weight: int | None = 1) -> int: ... @_dispatchable def dag_to_branching(G: Graph[_Node]) -> Graph[_Node]: ... diff --git a/stubs/networkx/networkx/algorithms/distance_measures.pyi b/stubs/networkx/networkx/algorithms/distance_measures.pyi index 35e356e71cb7..1f768011a2e9 100644 --- a/stubs/networkx/networkx/algorithms/distance_measures.pyi +++ b/stubs/networkx/networkx/algorithms/distance_measures.pyi @@ -1,18 +1,17 @@ -from _typeshed import Incomplete - +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def eccentricity(G, v: Incomplete | None = None, sp: Incomplete | None = None, weight: Incomplete | None = None): ... +def eccentricity(G: Graph[_Node], v: _Node | None = None, sp=None, weight: str | None = None): ... @_dispatchable -def diameter(G, e: Incomplete | None = None, usebounds: bool = False, weight: Incomplete | None = None): ... +def diameter(G: Graph[_Node], e=None, usebounds=False, weight: str | None = None): ... @_dispatchable -def periphery(G, e: Incomplete | None = None, usebounds: bool = False, weight: Incomplete | None = None): ... +def periphery(G: Graph[_Node], e=None, usebounds=False, weight: str | None = None): ... @_dispatchable -def radius(G, e: Incomplete | None = None, usebounds: bool = False, weight: Incomplete | None = None): ... +def radius(G: Graph[_Node], e=None, usebounds=False, weight: str | None = None): ... @_dispatchable -def center(G, e: Incomplete | None = None, usebounds: bool = False, weight: Incomplete | None = None): ... +def center(G: Graph[_Node], e=None, usebounds=False, weight: str | None = None): ... @_dispatchable -def barycenter(G, weight: Incomplete | None = None, attr: Incomplete | None = None, sp: Incomplete | None = None): ... +def barycenter(G, weight: str | None = None, attr=None, sp=None): ... @_dispatchable -def resistance_distance(G, nodeA, nodeB, weight: Incomplete | None = None, invert_weight: bool = True): ... +def resistance_distance(G: Graph[_Node], nodeA=None, nodeB=None, weight: str | None = None, invert_weight: bool = True): ... diff --git a/stubs/networkx/networkx/algorithms/distance_regular.pyi b/stubs/networkx/networkx/algorithms/distance_regular.pyi index e477deb4a0cb..182d37110f07 100644 --- a/stubs/networkx/networkx/algorithms/distance_regular.pyi +++ b/stubs/networkx/networkx/algorithms/distance_regular.pyi @@ -1,10 +1,11 @@ +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def is_distance_regular(G): ... +def is_distance_regular(G: Graph[_Node]): ... @_dispatchable def global_parameters(b, c): ... @_dispatchable -def intersection_array(G): ... +def intersection_array(G: Graph[_Node]): ... @_dispatchable -def is_strongly_regular(G): ... +def is_strongly_regular(G: Graph[_Node]): ... diff --git a/stubs/networkx/networkx/algorithms/dominance.pyi b/stubs/networkx/networkx/algorithms/dominance.pyi index a87b0172e7da..cc431c676e73 100644 --- a/stubs/networkx/networkx/algorithms/dominance.pyi +++ b/stubs/networkx/networkx/algorithms/dominance.pyi @@ -1,6 +1,7 @@ +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def immediate_dominators(G, start): ... +def immediate_dominators(G: Graph[_Node], start: _Node): ... @_dispatchable -def dominance_frontiers(G, start): ... +def dominance_frontiers(G: Graph[_Node], start: _Node): ... diff --git a/stubs/networkx/networkx/algorithms/dominating.pyi b/stubs/networkx/networkx/algorithms/dominating.pyi index 0f9535464f32..3786bb538077 100644 --- a/stubs/networkx/networkx/algorithms/dominating.pyi +++ b/stubs/networkx/networkx/algorithms/dominating.pyi @@ -1,8 +1,10 @@ from _typeshed import Incomplete +from collections.abc import Iterable +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def dominating_set(G, start_with: Incomplete | None = None): ... +def dominating_set(G: Graph[_Node], start_with: _Node | None = None): ... @_dispatchable -def is_dominating_set(G, nbunch): ... +def is_dominating_set(G: Graph[_Node], nbunch: Iterable[Incomplete]): ... diff --git a/stubs/networkx/networkx/algorithms/efficiency_measures.pyi b/stubs/networkx/networkx/algorithms/efficiency_measures.pyi index a0083616a943..420795a59a58 100644 --- a/stubs/networkx/networkx/algorithms/efficiency_measures.pyi +++ b/stubs/networkx/networkx/algorithms/efficiency_measures.pyi @@ -1,7 +1,8 @@ +from networkx.classes.graph import _Node from networkx.utils.backends import _dispatchable @_dispatchable -def efficiency(G, u, v): ... +def efficiency(G, u: _Node, v: _Node): ... @_dispatchable def global_efficiency(G): ... @_dispatchable diff --git a/stubs/networkx/networkx/algorithms/euler.pyi b/stubs/networkx/networkx/algorithms/euler.pyi index b88b278cc30e..0e8552402c8d 100644 --- a/stubs/networkx/networkx/algorithms/euler.pyi +++ b/stubs/networkx/networkx/algorithms/euler.pyi @@ -1,17 +1,20 @@ from _typeshed import Incomplete from collections.abc import Generator +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def is_eulerian(G): ... +def is_eulerian(G: Graph[_Node]): ... @_dispatchable def is_semieulerian(G): ... @_dispatchable -def eulerian_circuit(G, source: Incomplete | None = None, keys: bool = False) -> Generator[Incomplete, Incomplete, None]: ... +def eulerian_circuit( + G: Graph[_Node], source: _Node | None = None, keys: bool = False +) -> Generator[Incomplete, Incomplete, None]: ... @_dispatchable -def has_eulerian_path(G, source: Incomplete | None = None): ... +def has_eulerian_path(G: Graph[_Node], source: _Node | None = None): ... @_dispatchable -def eulerian_path(G, source: Incomplete | None = None, keys: bool = False) -> Generator[Incomplete, Incomplete, None]: ... +def eulerian_path(G: Graph[_Node], source=None, keys: bool = False) -> Generator[Incomplete, Incomplete, None]: ... @_dispatchable -def eulerize(G): ... +def eulerize(G: Graph[_Node]): ... diff --git a/stubs/networkx/networkx/algorithms/flow/boykovkolmogorov.pyi b/stubs/networkx/networkx/algorithms/flow/boykovkolmogorov.pyi index f5a6c21b3f23..1389aac0009d 100644 --- a/stubs/networkx/networkx/algorithms/flow/boykovkolmogorov.pyi +++ b/stubs/networkx/networkx/algorithms/flow/boykovkolmogorov.pyi @@ -1,14 +1,13 @@ -from _typeshed import Incomplete - +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable def boykov_kolmogorov( - G, - s, - t, + G: Graph[_Node], + s: _Node, + t: _Node, capacity: str = "capacity", - residual: Incomplete | None = None, + residual: Graph[_Node] | None = None, value_only: bool = False, - cutoff: Incomplete | None = None, + cutoff: float | None = None, ): ... diff --git a/stubs/networkx/networkx/algorithms/flow/capacityscaling.pyi b/stubs/networkx/networkx/algorithms/flow/capacityscaling.pyi index 36918442e80e..8f5b3bef312a 100644 --- a/stubs/networkx/networkx/algorithms/flow/capacityscaling.pyi +++ b/stubs/networkx/networkx/algorithms/flow/capacityscaling.pyi @@ -1,4 +1,7 @@ +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def capacity_scaling(G, demand: str = "demand", capacity: str = "capacity", weight: str = "weight", heap=...): ... +def capacity_scaling( + G: Graph[_Node], demand: str = "demand", capacity: str = "capacity", weight: str = "weight", heap: type = ... +): ... diff --git a/stubs/networkx/networkx/algorithms/flow/dinitz_alg.pyi b/stubs/networkx/networkx/algorithms/flow/dinitz_alg.pyi index 2a37c2973077..bd4c8bb1bdd6 100644 --- a/stubs/networkx/networkx/algorithms/flow/dinitz_alg.pyi +++ b/stubs/networkx/networkx/algorithms/flow/dinitz_alg.pyi @@ -1,14 +1,13 @@ -from _typeshed import Incomplete - +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable def dinitz( - G, - s, - t, + G: Graph[_Node], + s: _Node, + t: _Node, capacity: str = "capacity", - residual: Incomplete | None = None, + residual: Graph[_Node] | None = None, value_only: bool = False, - cutoff: Incomplete | None = None, + cutoff: float | None = None, ): ... diff --git a/stubs/networkx/networkx/algorithms/flow/edmondskarp.pyi b/stubs/networkx/networkx/algorithms/flow/edmondskarp.pyi index 0989f90f39d3..95fb8d5a3809 100644 --- a/stubs/networkx/networkx/algorithms/flow/edmondskarp.pyi +++ b/stubs/networkx/networkx/algorithms/flow/edmondskarp.pyi @@ -1,14 +1,13 @@ -from _typeshed import Incomplete - +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable def edmonds_karp( - G, - s, - t, + G: Graph[_Node], + s: _Node, + t: _Node, capacity: str = "capacity", - residual: Incomplete | None = None, + residual: Graph[_Node] | None = None, value_only: bool = False, - cutoff: Incomplete | None = None, + cutoff: float | None = None, ): ... diff --git a/stubs/networkx/networkx/algorithms/flow/gomory_hu.pyi b/stubs/networkx/networkx/algorithms/flow/gomory_hu.pyi index 5c7f878564d1..a1680ad0b727 100644 --- a/stubs/networkx/networkx/algorithms/flow/gomory_hu.pyi +++ b/stubs/networkx/networkx/algorithms/flow/gomory_hu.pyi @@ -1,12 +1,13 @@ from _typeshed import Incomplete +from collections.abc import Callable +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable from .edmondskarp import edmonds_karp __all__ = ["gomory_hu_tree"] - default_flow_func = edmonds_karp @_dispatchable -def gomory_hu_tree(G, capacity: str = "capacity", flow_func: Incomplete | None = None): ... +def gomory_hu_tree(G: Graph[_Node], capacity: str = "capacity", flow_func: Callable[..., Incomplete] | None = None): ... diff --git a/stubs/networkx/networkx/algorithms/flow/maxflow.pyi b/stubs/networkx/networkx/algorithms/flow/maxflow.pyi index f64d48aa8cdb..a94415cfb00d 100644 --- a/stubs/networkx/networkx/algorithms/flow/maxflow.pyi +++ b/stubs/networkx/networkx/algorithms/flow/maxflow.pyi @@ -1,18 +1,47 @@ from _typeshed import Incomplete +from collections.abc import Callable +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable from .preflowpush import preflow_push __all__ = ["maximum_flow", "maximum_flow_value", "minimum_cut", "minimum_cut_value"] - default_flow_func = preflow_push @_dispatchable -def maximum_flow(flowG, _s, _t, capacity: str = "capacity", flow_func: Incomplete | None = None, **kwargs): ... +def maximum_flow( + flowG: Graph[_Node], + _s: _Node, + _t: _Node, + capacity: str = "capacity", + flow_func: Callable[..., Incomplete] | None = None, + **kwargs, +): ... @_dispatchable -def maximum_flow_value(flowG, _s, _t, capacity: str = "capacity", flow_func: Incomplete | None = None, **kwargs): ... +def maximum_flow_value( + flowG: Graph[_Node], + _s: _Node, + _t: _Node, + capacity: str = "capacity", + flow_func: Callable[..., Incomplete] | None = None, + **kwargs, +): ... @_dispatchable -def minimum_cut(flowG, _s, _t, capacity: str = "capacity", flow_func: Incomplete | None = None, **kwargs): ... +def minimum_cut( + flowG: Graph[_Node], + _s: _Node, + _t: _Node, + capacity: str = "capacity", + flow_func: Callable[..., Incomplete] | None = None, + **kwargs, +): ... @_dispatchable -def minimum_cut_value(flowG, _s, _t, capacity: str = "capacity", flow_func: Incomplete | None = None, **kwargs): ... +def minimum_cut_value( + flowG: Graph[_Node], + _s: _Node, + _t: _Node, + capacity: str = "capacity", + flow_func: Callable[..., Incomplete] | None = None, + **kwargs, +): ... diff --git a/stubs/networkx/networkx/algorithms/flow/mincost.pyi b/stubs/networkx/networkx/algorithms/flow/mincost.pyi index 41f70569369b..86e0834f567e 100644 --- a/stubs/networkx/networkx/algorithms/flow/mincost.pyi +++ b/stubs/networkx/networkx/algorithms/flow/mincost.pyi @@ -1,10 +1,13 @@ +from _typeshed import Incomplete, SupportsGetItem + +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def min_cost_flow_cost(G, demand: str = "demand", capacity: str = "capacity", weight: str = "weight"): ... +def min_cost_flow_cost(G: Graph[_Node], demand: str = "demand", capacity: str = "capacity", weight: str = "weight"): ... @_dispatchable -def min_cost_flow(G, demand: str = "demand", capacity: str = "capacity", weight: str = "weight"): ... +def min_cost_flow(G: Graph[_Node], demand: str = "demand", capacity: str = "capacity", weight: str = "weight"): ... @_dispatchable -def cost_of_flow(G, flowDict, weight: str = "weight"): ... +def cost_of_flow(G: Graph[_Node], flowDict: SupportsGetItem[Incomplete, Incomplete], weight: str = "weight"): ... @_dispatchable -def max_flow_min_cost(G, s, t, capacity: str = "capacity", weight: str = "weight"): ... +def max_flow_min_cost(G: Graph[_Node], s: str, t: str, capacity: str = "capacity", weight: str = "weight"): ... diff --git a/stubs/networkx/networkx/algorithms/flow/networksimplex.pyi b/stubs/networkx/networkx/algorithms/flow/networksimplex.pyi index dcbc88ac35c6..b9cf6bae5b18 100644 --- a/stubs/networkx/networkx/algorithms/flow/networksimplex.pyi +++ b/stubs/networkx/networkx/algorithms/flow/networksimplex.pyi @@ -1,6 +1,7 @@ from _typeshed import Incomplete from collections.abc import Generator +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable class _DataEssentialsAndFunctions: @@ -22,6 +23,7 @@ class _DataEssentialsAndFunctions: next_node_dft: Incomplete prev_node_dft: Incomplete last_descendent_dft: Incomplete + def __init__(self, G, multigraph, demand: str = "demand", capacity: str = "capacity", weight: str = "weight") -> None: ... def initialize_spanning_tree(self, n, faux_inf) -> None: ... def find_apex(self, p, q): ... @@ -39,4 +41,4 @@ class _DataEssentialsAndFunctions: def find_leaving_edge(self, Wn, We): ... @_dispatchable -def network_simplex(G, demand: str = "demand", capacity: str = "capacity", weight: str = "weight"): ... +def network_simplex(G: Graph[_Node], demand: str = "demand", capacity: str = "capacity", weight: str = "weight"): ... diff --git a/stubs/networkx/networkx/algorithms/flow/preflowpush.pyi b/stubs/networkx/networkx/algorithms/flow/preflowpush.pyi index 51547a1c03a1..cd25f1cb00bd 100644 --- a/stubs/networkx/networkx/algorithms/flow/preflowpush.pyi +++ b/stubs/networkx/networkx/algorithms/flow/preflowpush.pyi @@ -1,14 +1,13 @@ -from _typeshed import Incomplete - +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable def preflow_push( - G, - s, - t, + G: Graph[_Node], + s: _Node, + t: _Node, capacity: str = "capacity", - residual: Incomplete | None = None, + residual: Graph[_Node] | None = None, global_relabel_freq: float = 1, value_only: bool = False, ): ... diff --git a/stubs/networkx/networkx/algorithms/flow/shortestaugmentingpath.pyi b/stubs/networkx/networkx/algorithms/flow/shortestaugmentingpath.pyi index 93fdf09f637c..43b5ae4af72c 100644 --- a/stubs/networkx/networkx/algorithms/flow/shortestaugmentingpath.pyi +++ b/stubs/networkx/networkx/algorithms/flow/shortestaugmentingpath.pyi @@ -1,15 +1,14 @@ -from _typeshed import Incomplete - +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable def shortest_augmenting_path( - G, - s, - t, + G: Graph[_Node], + s: _Node, + t: _Node, capacity: str = "capacity", - residual: Incomplete | None = None, + residual: Graph[_Node] | None = None, value_only: bool = False, two_phase: bool = False, - cutoff: Incomplete | None = None, + cutoff: float | None = None, ): ... diff --git a/stubs/networkx/networkx/algorithms/flow/utils.pyi b/stubs/networkx/networkx/algorithms/flow/utils.pyi index 04c99b4ed081..3b041a5fc2b1 100644 --- a/stubs/networkx/networkx/algorithms/flow/utils.pyi +++ b/stubs/networkx/networkx/algorithms/flow/utils.pyi @@ -10,6 +10,7 @@ class CurrentEdge: class Level: active: Incomplete inactive: Incomplete + def __init__(self) -> None: ... class GlobalRelabelThreshold: diff --git a/stubs/networkx/networkx/algorithms/graph_hashing.pyi b/stubs/networkx/networkx/algorithms/graph_hashing.pyi index 218bf2f6a0d5..98b93f08f7b1 100644 --- a/stubs/networkx/networkx/algorithms/graph_hashing.pyi +++ b/stubs/networkx/networkx/algorithms/graph_hashing.pyi @@ -1,12 +1,20 @@ -from _typeshed import Incomplete - +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable def weisfeiler_lehman_graph_hash( - G, edge_attr: Incomplete | None = None, node_attr: Incomplete | None = None, iterations: int = 3, digest_size: int = 16 + G: Graph[_Node], + edge_attr: str | None = None, + node_attr: str | None = None, + iterations: int | None = 3, + digest_size: int | None = 16, ): ... @_dispatchable def weisfeiler_lehman_subgraph_hashes( - G, edge_attr: Incomplete | None = None, node_attr: Incomplete | None = None, iterations: int = 3, digest_size: int = 16 + G: Graph[_Node], + edge_attr: str | None = None, + node_attr: str | None = None, + iterations: int | None = 3, + digest_size: int | None = 16, + include_initial_labels: bool | None = False, ): ... diff --git a/stubs/networkx/networkx/algorithms/graphical.pyi b/stubs/networkx/networkx/algorithms/graphical.pyi index 5f886377b9b7..87c3a9068dfd 100644 --- a/stubs/networkx/networkx/algorithms/graphical.pyi +++ b/stubs/networkx/networkx/algorithms/graphical.pyi @@ -1,14 +1,17 @@ +from _typeshed import Incomplete +from collections.abc import Iterable + from networkx.utils.backends import _dispatchable @_dispatchable -def is_graphical(sequence, method: str = "eg"): ... +def is_graphical(sequence: Iterable[Incomplete], method="eg"): ... @_dispatchable -def is_valid_degree_sequence_havel_hakimi(deg_sequence): ... +def is_valid_degree_sequence_havel_hakimi(deg_sequence: Iterable[Incomplete]): ... @_dispatchable -def is_valid_degree_sequence_erdos_gallai(deg_sequence): ... +def is_valid_degree_sequence_erdos_gallai(deg_sequence: Iterable[Incomplete]): ... @_dispatchable -def is_multigraphical(sequence): ... +def is_multigraphical(sequence: Iterable[Incomplete]): ... @_dispatchable -def is_pseudographical(sequence): ... +def is_pseudographical(sequence: Iterable[Incomplete]): ... @_dispatchable -def is_digraphical(in_sequence, out_sequence): ... +def is_digraphical(in_sequence: Iterable[Incomplete], out_sequence: Iterable[Incomplete]): ... diff --git a/stubs/networkx/networkx/algorithms/hierarchy.pyi b/stubs/networkx/networkx/algorithms/hierarchy.pyi index 09f4dc139b70..e747ffc5109e 100644 --- a/stubs/networkx/networkx/algorithms/hierarchy.pyi +++ b/stubs/networkx/networkx/algorithms/hierarchy.pyi @@ -1,6 +1,4 @@ -from _typeshed import Incomplete - from networkx.utils.backends import _dispatchable @_dispatchable -def flow_hierarchy(G, weight: Incomplete | None = None): ... +def flow_hierarchy(G, weight: str | None = None): ... diff --git a/stubs/networkx/networkx/algorithms/hybrid.pyi b/stubs/networkx/networkx/algorithms/hybrid.pyi index 3bbc857d1feb..171162022da3 100644 --- a/stubs/networkx/networkx/algorithms/hybrid.pyi +++ b/stubs/networkx/networkx/algorithms/hybrid.pyi @@ -1,6 +1,7 @@ +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def kl_connected_subgraph(G, k, l, low_memory: bool = False, same_as_graph: bool = False): ... +def kl_connected_subgraph(G: Graph[_Node], k: int, l: int, low_memory: bool = False, same_as_graph: bool = False): ... @_dispatchable -def is_kl_connected(G, k, l, low_memory: bool = False): ... +def is_kl_connected(G: Graph[_Node], k: int, l: int, low_memory: bool = False): ... diff --git a/stubs/networkx/networkx/algorithms/isolate.pyi b/stubs/networkx/networkx/algorithms/isolate.pyi index 1030cb1c5bb4..d08ac5b19588 100644 --- a/stubs/networkx/networkx/algorithms/isolate.pyi +++ b/stubs/networkx/networkx/algorithms/isolate.pyi @@ -1,8 +1,9 @@ +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def is_isolate(G, n): ... +def is_isolate(G: Graph[_Node], n: _Node): ... @_dispatchable -def isolates(G): ... +def isolates(G: Graph[_Node]): ... @_dispatchable -def number_of_isolates(G): ... +def number_of_isolates(G: Graph[_Node]): ... diff --git a/stubs/networkx/networkx/algorithms/isomorphism/ismags.pyi b/stubs/networkx/networkx/algorithms/isomorphism/ismags.pyi index 259d9f7735ce..4a64a8191674 100644 --- a/stubs/networkx/networkx/algorithms/isomorphism/ismags.pyi +++ b/stubs/networkx/networkx/algorithms/isomorphism/ismags.pyi @@ -6,6 +6,7 @@ class ISMAGS: subgraph: Incomplete node_equality: Incomplete edge_equality: Incomplete + def __init__( self, graph, diff --git a/stubs/networkx/networkx/algorithms/isomorphism/isomorph.pyi b/stubs/networkx/networkx/algorithms/isomorphism/isomorph.pyi index 895b71cb59af..369615e1ba06 100644 --- a/stubs/networkx/networkx/algorithms/isomorphism/isomorph.pyi +++ b/stubs/networkx/networkx/algorithms/isomorphism/isomorph.pyi @@ -1,23 +1,30 @@ from _typeshed import Incomplete +from collections.abc import Callable +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable __all__ = ["could_be_isomorphic", "fast_could_be_isomorphic", "faster_could_be_isomorphic", "is_isomorphic"] @_dispatchable -def could_be_isomorphic(G1, G2): ... +def could_be_isomorphic(G1: Graph[_Node], G2: Graph[_Node]): ... graph_could_be_isomorphic = could_be_isomorphic @_dispatchable -def fast_could_be_isomorphic(G1, G2): ... +def fast_could_be_isomorphic(G1: Graph[_Node], G2: Graph[_Node]): ... fast_graph_could_be_isomorphic = fast_could_be_isomorphic @_dispatchable -def faster_could_be_isomorphic(G1, G2): ... +def faster_could_be_isomorphic(G1: Graph[_Node], G2: Graph[_Node]): ... faster_graph_could_be_isomorphic = faster_could_be_isomorphic @_dispatchable -def is_isomorphic(G1, G2, node_match: Incomplete | None = None, edge_match: Incomplete | None = None): ... +def is_isomorphic( + G1: Graph[_Node], + G2: Graph[_Node], + node_match: Callable[..., Incomplete] | None = None, + edge_match: Callable[..., Incomplete] | None = None, +): ... diff --git a/stubs/networkx/networkx/algorithms/isomorphism/isomorphvf2.pyi b/stubs/networkx/networkx/algorithms/isomorphism/isomorphvf2.pyi index 7b2e2c3d296d..dd57778fcc7a 100644 --- a/stubs/networkx/networkx/algorithms/isomorphism/isomorphvf2.pyi +++ b/stubs/networkx/networkx/algorithms/isomorphism/isomorphvf2.pyi @@ -11,6 +11,7 @@ class GraphMatcher: G2_node_order: Incomplete old_recursion_limit: Incomplete test: str + def __init__(self, G1, G2) -> None: ... def reset_recursion_limit(self) -> None: ... def candidate_pairs_iter(self) -> Generator[Incomplete, None, None]: ... @@ -20,6 +21,7 @@ class GraphMatcher: inout_2: Incomplete state: Incomplete mapping: Incomplete + def initialize(self) -> None: ... def is_isomorphic(self): ... def isomorphisms_iter(self) -> Generator[Incomplete, Incomplete, None]: ... @@ -42,6 +44,7 @@ class DiGraphMatcher(GraphMatcher): out_2: Incomplete state: Incomplete mapping: Incomplete + def initialize(self) -> None: ... def syntactic_feasibility(self, G1_node, G2_node): ... @@ -50,6 +53,7 @@ class GMState: G1_node: Incomplete G2_node: Incomplete depth: Incomplete + def __init__(self, GM, G1_node: Incomplete | None = None, G2_node: Incomplete | None = None) -> None: ... def restore(self) -> None: ... @@ -58,5 +62,6 @@ class DiGMState: G1_node: Incomplete G2_node: Incomplete depth: Incomplete + def __init__(self, GM, G1_node: Incomplete | None = None, G2_node: Incomplete | None = None) -> None: ... def restore(self) -> None: ... diff --git a/stubs/networkx/networkx/algorithms/isomorphism/temporalisomorphvf2.pyi b/stubs/networkx/networkx/algorithms/isomorphism/temporalisomorphvf2.pyi index a3200872c5e1..060f3d193541 100644 --- a/stubs/networkx/networkx/algorithms/isomorphism/temporalisomorphvf2.pyi +++ b/stubs/networkx/networkx/algorithms/isomorphism/temporalisomorphvf2.pyi @@ -7,6 +7,7 @@ __all__ = ["TimeRespectingGraphMatcher", "TimeRespectingDiGraphMatcher"] class TimeRespectingGraphMatcher(GraphMatcher): temporal_attribute_name: Incomplete delta: Incomplete + def __init__(self, G1, G2, temporal_attribute_name, delta) -> None: ... def one_hop(self, Gx, Gx_node, neighbors): ... def two_hop(self, Gx, core_x, Gx_node, neighbors): ... @@ -15,6 +16,7 @@ class TimeRespectingGraphMatcher(GraphMatcher): class TimeRespectingDiGraphMatcher(DiGraphMatcher): temporal_attribute_name: Incomplete delta: Incomplete + def __init__(self, G1, G2, temporal_attribute_name, delta) -> None: ... def get_pred_dates(self, Gx, Gx_node, core_x, pred): ... def get_succ_dates(self, Gx, Gx_node, core_x, succ): ... diff --git a/stubs/networkx/networkx/algorithms/isomorphism/tree_isomorphism.pyi b/stubs/networkx/networkx/algorithms/isomorphism/tree_isomorphism.pyi index 8c56107e1774..5cfad7cd15cd 100644 --- a/stubs/networkx/networkx/algorithms/isomorphism/tree_isomorphism.pyi +++ b/stubs/networkx/networkx/algorithms/isomorphism/tree_isomorphism.pyi @@ -1,6 +1,7 @@ +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable def rooted_tree_isomorphism(t1, root1, t2, root2): ... @_dispatchable -def tree_isomorphism(t1, t2): ... +def tree_isomorphism(t1: Graph[_Node], t2: Graph[_Node]): ... diff --git a/stubs/networkx/networkx/algorithms/isomorphism/vf2pp.pyi b/stubs/networkx/networkx/algorithms/isomorphism/vf2pp.pyi index d8916fbadba8..704bdcfc0f26 100644 --- a/stubs/networkx/networkx/algorithms/isomorphism/vf2pp.pyi +++ b/stubs/networkx/networkx/algorithms/isomorphism/vf2pp.pyi @@ -2,6 +2,7 @@ from _typeshed import Incomplete from collections.abc import Generator from typing import NamedTuple +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable class _GraphParameters(NamedTuple): @@ -26,10 +27,12 @@ class _StateParameters(NamedTuple): T2_tilde_in: Incomplete @_dispatchable -def vf2pp_isomorphism(G1, G2, node_label: Incomplete | None = None, default_label: Incomplete | None = None): ... +def vf2pp_isomorphism(G1: Graph[_Node], G2: Graph[_Node], node_label: str | None = None, default_label: float | None = None): ... @_dispatchable -def vf2pp_is_isomorphic(G1, G2, node_label: Incomplete | None = None, default_label: Incomplete | None = None): ... +def vf2pp_is_isomorphic( + G1: Graph[_Node], G2: Graph[_Node], node_label: str | None = None, default_label: float | None = None +): ... @_dispatchable def vf2pp_all_isomorphisms( - G1, G2, node_label: Incomplete | None = None, default_label: Incomplete | None = None + G1: Graph[_Node], G2: Graph[_Node], node_label: str | None = None, default_label: float | None = None ) -> Generator[Incomplete, None, Incomplete]: ... diff --git a/stubs/networkx/networkx/algorithms/isomorphism/vf2userfunc.pyi b/stubs/networkx/networkx/algorithms/isomorphism/vf2userfunc.pyi index 5c84c8f6c340..3800601bc5e9 100644 --- a/stubs/networkx/networkx/algorithms/isomorphism/vf2userfunc.pyi +++ b/stubs/networkx/networkx/algorithms/isomorphism/vf2userfunc.pyi @@ -9,6 +9,7 @@ class GraphMatcher(vf2.GraphMatcher): edge_match: Incomplete G1_adj: Incomplete G2_adj: Incomplete + def __init__(self, G1, G2, node_match: Incomplete | None = None, edge_match: Incomplete | None = None) -> None: ... semantic_feasibility: Incomplete @@ -17,6 +18,7 @@ class DiGraphMatcher(vf2.DiGraphMatcher): edge_match: Incomplete G1_adj: Incomplete G2_adj: Incomplete + def __init__(self, G1, G2, node_match: Incomplete | None = None, edge_match: Incomplete | None = None) -> None: ... def semantic_feasibility(self, G1_node, G2_node): ... diff --git a/stubs/networkx/networkx/algorithms/link_analysis/hits_alg.pyi b/stubs/networkx/networkx/algorithms/link_analysis/hits_alg.pyi index d2dba97399b5..b91bc4610a9d 100644 --- a/stubs/networkx/networkx/algorithms/link_analysis/hits_alg.pyi +++ b/stubs/networkx/networkx/algorithms/link_analysis/hits_alg.pyi @@ -1,6 +1,13 @@ -from _typeshed import Incomplete +from _typeshed import Incomplete, SupportsGetItem +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def hits(G, max_iter: int = 100, tol: float = 1e-08, nstart: Incomplete | None = None, normalized: bool = True): ... +def hits( + G: Graph[_Node], + max_iter: int | None = 100, + tol: float | None = 1e-08, + nstart: SupportsGetItem[Incomplete, Incomplete] | None = None, + normalized: bool = True, +): ... diff --git a/stubs/networkx/networkx/algorithms/link_analysis/pagerank_alg.pyi b/stubs/networkx/networkx/algorithms/link_analysis/pagerank_alg.pyi index 2ed3765aecce..cb3ab19ce19d 100644 --- a/stubs/networkx/networkx/algorithms/link_analysis/pagerank_alg.pyi +++ b/stubs/networkx/networkx/algorithms/link_analysis/pagerank_alg.pyi @@ -1,24 +1,26 @@ -from _typeshed import Incomplete +from _typeshed import Incomplete, SupportsGetItem +from collections.abc import Iterable +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable def pagerank( - G, - alpha: float = 0.85, - personalization: Incomplete | None = None, - max_iter: int = 100, - tol: float = 1e-06, - nstart: Incomplete | None = None, - weight: str = "weight", - dangling: Incomplete | None = None, + G: Graph[_Node], + alpha: float | None = 0.85, + personalization: SupportsGetItem[Incomplete, Incomplete] | None = None, + max_iter: int | None = 100, + tol: float | None = 1e-06, + nstart: SupportsGetItem[Incomplete, Incomplete] | None = None, + weight: str | None = "weight", + dangling: SupportsGetItem[Incomplete, Incomplete] | None = None, ): ... @_dispatchable def google_matrix( - G, + G: Graph[_Node], alpha: float = 0.85, - personalization: Incomplete | None = None, - nodelist: Incomplete | None = None, - weight: str = "weight", - dangling: Incomplete | None = None, + personalization: SupportsGetItem[Incomplete, Incomplete] | None = None, + nodelist: Iterable[Incomplete] | None = None, + weight: str | None = "weight", + dangling: SupportsGetItem[Incomplete, Incomplete] | None = None, ): ... diff --git a/stubs/networkx/networkx/algorithms/link_prediction.pyi b/stubs/networkx/networkx/algorithms/link_prediction.pyi index 1ef94518386e..6c298d3ca531 100644 --- a/stubs/networkx/networkx/algorithms/link_prediction.pyi +++ b/stubs/networkx/networkx/algorithms/link_prediction.pyi @@ -1,20 +1,19 @@ -from _typeshed import Incomplete - +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def resource_allocation_index(G, ebunch: Incomplete | None = None): ... +def resource_allocation_index(G: Graph[_Node], ebunch=None): ... @_dispatchable -def jaccard_coefficient(G, ebunch: Incomplete | None = None): ... +def jaccard_coefficient(G: Graph[_Node], ebunch=None): ... @_dispatchable -def adamic_adar_index(G, ebunch: Incomplete | None = None): ... +def adamic_adar_index(G: Graph[_Node], ebunch=None): ... @_dispatchable -def common_neighbor_centrality(G, ebunch: Incomplete | None = None, alpha: float = 0.8): ... +def common_neighbor_centrality(G: Graph[_Node], ebunch=None, alpha=0.8): ... @_dispatchable -def preferential_attachment(G, ebunch: Incomplete | None = None): ... +def preferential_attachment(G: Graph[_Node], ebunch=None): ... @_dispatchable -def cn_soundarajan_hopcroft(G, ebunch: Incomplete | None = None, community: str = "community"): ... +def cn_soundarajan_hopcroft(G: Graph[_Node], ebunch=None, community: str | None = "community"): ... @_dispatchable -def ra_index_soundarajan_hopcroft(G, ebunch: Incomplete | None = None, community: str = "community"): ... +def ra_index_soundarajan_hopcroft(G: Graph[_Node], ebunch=None, community: str | None = "community"): ... @_dispatchable -def within_inter_cluster(G, ebunch: Incomplete | None = None, delta: float = 0.001, community: str = "community"): ... +def within_inter_cluster(G: Graph[_Node], ebunch=None, delta: float | None = 0.001, community: str | None = "community"): ... diff --git a/stubs/networkx/networkx/algorithms/lowest_common_ancestors.pyi b/stubs/networkx/networkx/algorithms/lowest_common_ancestors.pyi index 700a7fce8c73..b884ed0cdd2c 100644 --- a/stubs/networkx/networkx/algorithms/lowest_common_ancestors.pyi +++ b/stubs/networkx/networkx/algorithms/lowest_common_ancestors.pyi @@ -1,13 +1,15 @@ from _typeshed import Incomplete from collections.abc import Generator +from networkx.classes.digraph import DiGraph +from networkx.classes.graph import _Node from networkx.utils.backends import _dispatchable @_dispatchable -def all_pairs_lowest_common_ancestor(G, pairs: Incomplete | None = None): ... +def all_pairs_lowest_common_ancestor(G: DiGraph[_Node], pairs=None): ... @_dispatchable -def lowest_common_ancestor(G, node1, node2, default: Incomplete | None = None): ... +def lowest_common_ancestor(G: DiGraph[_Node], node1, node2, default: Incomplete | None = None): ... @_dispatchable def tree_all_pairs_lowest_common_ancestor( - G, root: Incomplete | None = None, pairs: Incomplete | None = None + G: DiGraph[_Node], root: _Node | None = None, pairs=None ) -> Generator[Incomplete, None, None]: ... diff --git a/stubs/networkx/networkx/algorithms/matching.pyi b/stubs/networkx/networkx/algorithms/matching.pyi index ba797a5a12b3..cf7301679632 100644 --- a/stubs/networkx/networkx/algorithms/matching.pyi +++ b/stubs/networkx/networkx/algorithms/matching.pyi @@ -1,14 +1,15 @@ +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def maximal_matching(G): ... +def maximal_matching(G: Graph[_Node]): ... @_dispatchable -def is_matching(G, matching): ... +def is_matching(G: Graph[_Node], matching): ... @_dispatchable -def is_maximal_matching(G, matching): ... +def is_maximal_matching(G: Graph[_Node], matching): ... @_dispatchable -def is_perfect_matching(G, matching): ... +def is_perfect_matching(G: Graph[_Node], matching): ... @_dispatchable -def min_weight_matching(G, weight: str = "weight"): ... +def min_weight_matching(G: Graph[_Node], weight: str | None = "weight"): ... @_dispatchable -def max_weight_matching(G, maxcardinality: bool = False, weight: str = "weight"): ... +def max_weight_matching(G: Graph[_Node], maxcardinality: bool | None = False, weight: str | None = "weight"): ... diff --git a/stubs/networkx/networkx/algorithms/minors/contraction.pyi b/stubs/networkx/networkx/algorithms/minors/contraction.pyi index c76c1b1b5d48..40dc9a0adda3 100644 --- a/stubs/networkx/networkx/algorithms/minors/contraction.pyi +++ b/stubs/networkx/networkx/algorithms/minors/contraction.pyi @@ -1,23 +1,26 @@ from _typeshed import Incomplete +from collections.abc import Callable +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable def equivalence_classes(iterable, relation): ... @_dispatchable def quotient_graph( - G, + G: Graph[_Node], partition, - edge_relation: Incomplete | None = None, - node_data: Incomplete | None = None, - edge_data: Incomplete | None = None, + edge_relation=None, + node_data: Callable[..., Incomplete] | None = None, + edge_data: Callable[..., Incomplete] | None = None, + weight: str | None = "weight", relabel: bool = False, - create_using: Incomplete | None = None, + create_using: Graph[_Node] | None = None, ): ... @_dispatchable -def contracted_nodes(G, u, v, self_loops: bool = True, copy: bool = True): ... +def contracted_nodes(G: Graph[_Node], u, v, self_loops: bool = True, copy: bool = True): ... identified_nodes = contracted_nodes @_dispatchable -def contracted_edge(G, edge, self_loops: bool = True, copy: bool = True): ... +def contracted_edge(G: Graph[_Node], edge: tuple[Incomplete], self_loops: bool = True, copy: bool = True): ... diff --git a/stubs/networkx/networkx/algorithms/mis.pyi b/stubs/networkx/networkx/algorithms/mis.pyi index 1d4b262dde29..66ec315178b7 100644 --- a/stubs/networkx/networkx/algorithms/mis.pyi +++ b/stubs/networkx/networkx/algorithms/mis.pyi @@ -1,6 +1,11 @@ from _typeshed import Incomplete +from collections.abc import Iterable +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable +from numpy.random import RandomState @_dispatchable -def maximal_independent_set(G, nodes: Incomplete | None = None, seed: Incomplete | None = None): ... +def maximal_independent_set( + G: Graph[_Node], nodes: Iterable[Incomplete] | None = None, seed: int | RandomState | None = None +): ... diff --git a/stubs/networkx/networkx/algorithms/moral.pyi b/stubs/networkx/networkx/algorithms/moral.pyi index 570061651f86..626c6c3f0393 100644 --- a/stubs/networkx/networkx/algorithms/moral.pyi +++ b/stubs/networkx/networkx/algorithms/moral.pyi @@ -1,4 +1,5 @@ +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def moral_graph(G): ... +def moral_graph(G: Graph[_Node]): ... diff --git a/stubs/networkx/networkx/algorithms/node_classification.pyi b/stubs/networkx/networkx/algorithms/node_classification.pyi index 510c72a25e3d..45f0e4df7886 100644 --- a/stubs/networkx/networkx/algorithms/node_classification.pyi +++ b/stubs/networkx/networkx/algorithms/node_classification.pyi @@ -1,6 +1,7 @@ +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def harmonic_function(G, max_iter: int = 30, label_name: str = "label"): ... +def harmonic_function(G: Graph[_Node], max_iter: int = 30, label_name: str = "label"): ... @_dispatchable -def local_and_global_consistency(G, alpha: float = 0.99, max_iter: int = 30, label_name: str = "label"): ... +def local_and_global_consistency(G: Graph[_Node], alpha: float = 0.99, max_iter: int = 30, label_name: str = "label"): ... diff --git a/stubs/networkx/networkx/algorithms/non_randomness.pyi b/stubs/networkx/networkx/algorithms/non_randomness.pyi index 5e0941436883..fc1f04b00f2e 100644 --- a/stubs/networkx/networkx/algorithms/non_randomness.pyi +++ b/stubs/networkx/networkx/algorithms/non_randomness.pyi @@ -1,6 +1,5 @@ -from _typeshed import Incomplete - +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def non_randomness(G, k: Incomplete | None = None, weight: str = "weight"): ... +def non_randomness(G: Graph[_Node], k: int | None = None, weight: str | None = "weight"): ... diff --git a/stubs/networkx/networkx/algorithms/operators/all.pyi b/stubs/networkx/networkx/algorithms/operators/all.pyi index a595296a7853..67e66bfcf29c 100644 --- a/stubs/networkx/networkx/algorithms/operators/all.pyi +++ b/stubs/networkx/networkx/algorithms/operators/all.pyi @@ -1,10 +1,13 @@ +from _typeshed import Incomplete +from collections.abc import Iterable + from networkx.utils.backends import _dispatchable @_dispatchable -def union_all(graphs, rename=()): ... +def union_all(graphs: Iterable[Incomplete], rename: Iterable[Incomplete] | None = ()): ... @_dispatchable -def disjoint_union_all(graphs): ... +def disjoint_union_all(graphs: Iterable[Incomplete]): ... @_dispatchable -def compose_all(graphs): ... +def compose_all(graphs: Iterable[Incomplete]): ... @_dispatchable -def intersection_all(graphs): ... +def intersection_all(graphs: Iterable[Incomplete]): ... diff --git a/stubs/networkx/networkx/algorithms/operators/binary.pyi b/stubs/networkx/networkx/algorithms/operators/binary.pyi index ef7f4943ca52..9e794329668f 100644 --- a/stubs/networkx/networkx/algorithms/operators/binary.pyi +++ b/stubs/networkx/networkx/algorithms/operators/binary.pyi @@ -1,24 +1,24 @@ -from collections.abc import Hashable +from _typeshed import Incomplete +from collections.abc import Hashable, Iterable from typing import TypeVar from networkx.classes.digraph import DiGraph +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def disjoint_union(G, H): ... +def disjoint_union(G: Graph[_Node], H: Graph[_Node]): ... @_dispatchable -def intersection(G, H): ... +def intersection(G: Graph[_Node], H: Graph[_Node]): ... @_dispatchable -def difference(G, H): ... +def difference(G: Graph[_Node], H: Graph[_Node]): ... @_dispatchable -def symmetric_difference(G, H): ... +def symmetric_difference(G: Graph[_Node], H: Graph[_Node]): ... _X = TypeVar("_X", bound=Hashable, covariant=True) _Y = TypeVar("_Y", bound=Hashable, covariant=True) -# GT = TypeVar('GT', bound=Graph[_Node]) -# TODO: This does not handle the cases when graphs of different types are passed which is allowed @_dispatchable -def compose(G: DiGraph[_X], H: DiGraph[_Y]) -> DiGraph[_X | _Y]: ... +def compose(G: Graph[_X], H: Graph[_Y]) -> DiGraph[_X | _Y]: ... @_dispatchable -def union(G: DiGraph[_X], H: DiGraph[_Y], rename=()) -> DiGraph[_X | _Y]: ... +def union(G: Graph[_X], H: Graph[_Y], rename: Iterable[Incomplete] | None = ()) -> DiGraph[_X | _Y]: ... diff --git a/stubs/networkx/networkx/algorithms/operators/product.pyi b/stubs/networkx/networkx/algorithms/operators/product.pyi index 96b54b2d4275..de12cd51bd36 100644 --- a/stubs/networkx/networkx/algorithms/operators/product.pyi +++ b/stubs/networkx/networkx/algorithms/operators/product.pyi @@ -1,16 +1,23 @@ +from collections.abc import Hashable +from typing import TypeVar + +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable +_X = TypeVar("_X", bound=Hashable) +_Y = TypeVar("_Y", bound=Hashable) + @_dispatchable -def tensor_product(G, H): ... +def tensor_product(G: Graph[_X], H: Graph[_Y]) -> Graph[tuple[_X, _Y]]: ... @_dispatchable -def cartesian_product(G, H): ... +def cartesian_product(G: Graph[_X], H: Graph[_Y]) -> Graph[tuple[_X, _Y]]: ... @_dispatchable -def lexicographic_product(G, H): ... +def lexicographic_product(G: Graph[_X], H: Graph[_Y]) -> Graph[tuple[_X, _Y]]: ... @_dispatchable -def strong_product(G, H): ... +def strong_product(G: Graph[_X], H: Graph[_Y]) -> Graph[tuple[_X, _Y]]: ... @_dispatchable -def power(G, k): ... +def power(G: Graph[_Node], k): ... @_dispatchable -def rooted_product(G, H, root): ... +def rooted_product(G: Graph[_X], H: Graph[_Y], root: _Y) -> Graph[tuple[_X, _Y]]: ... @_dispatchable -def corona_product(G, H): ... +def corona_product(G: Graph[_X], H: Graph[_Y]) -> Graph[tuple[_X, _Y]]: ... diff --git a/stubs/networkx/networkx/algorithms/operators/unary.pyi b/stubs/networkx/networkx/algorithms/operators/unary.pyi index b17f988839b3..cda8ebbf6b45 100644 --- a/stubs/networkx/networkx/algorithms/operators/unary.pyi +++ b/stubs/networkx/networkx/algorithms/operators/unary.pyi @@ -1,12 +1,12 @@ from collections.abc import Hashable from typing import TypeVar -from networkx.classes.graph import Graph +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable _G = TypeVar("_G", bound=Graph[Hashable]) @_dispatchable -def complement(G): ... +def complement(G: Graph[_Node]): ... @_dispatchable def reverse(G: _G, copy: bool = True) -> _G: ... diff --git a/stubs/networkx/networkx/algorithms/planarity.pyi b/stubs/networkx/networkx/algorithms/planarity.pyi index 5df3c945c7c4..9b1ba3b297fe 100644 --- a/stubs/networkx/networkx/algorithms/planarity.pyi +++ b/stubs/networkx/networkx/algorithms/planarity.pyi @@ -2,19 +2,20 @@ from _typeshed import Incomplete from collections.abc import Generator, Mapping, MutableSet, Reversible from networkx.classes.digraph import DiGraph -from networkx.classes.graph import _Node +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable __all__ = ["check_planarity", "is_planar", "PlanarEmbedding"] @_dispatchable -def is_planar(G) -> bool: ... +def is_planar(G: Graph[_Node]) -> bool: ... @_dispatchable -def check_planarity(G, counterexample: bool = False): ... +def check_planarity(G: Graph[_Node], counterexample: bool = False): ... class Interval: low: Incomplete high: Incomplete + def __init__(self, low: Incomplete | None = None, high: Incomplete | None = None) -> None: ... def empty(self): ... def copy(self): ... @@ -23,6 +24,7 @@ class Interval: class ConflictPair: left: Incomplete right: Incomplete + def __init__(self, left=..., right=...) -> None: ... def swap(self) -> None: ... def lowest(self, planarity_state): ... @@ -46,6 +48,7 @@ class LRPlanarity: left_ref: Incomplete right_ref: Incomplete embedding: Incomplete + def __init__(self, G) -> None: ... def lr_planarity(self): ... def lr_planarity_recursive(self): ... diff --git a/stubs/networkx/networkx/algorithms/polynomials.pyi b/stubs/networkx/networkx/algorithms/polynomials.pyi index 805beff63985..cadffc38a170 100644 --- a/stubs/networkx/networkx/algorithms/polynomials.pyi +++ b/stubs/networkx/networkx/algorithms/polynomials.pyi @@ -1,6 +1,7 @@ +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def tutte_polynomial(G): ... +def tutte_polynomial(G: Graph[_Node]): ... @_dispatchable -def chromatic_polynomial(G): ... +def chromatic_polynomial(G: Graph[_Node]): ... diff --git a/stubs/networkx/networkx/algorithms/reciprocity.pyi b/stubs/networkx/networkx/algorithms/reciprocity.pyi index 3af842628188..547dc885d5cc 100644 --- a/stubs/networkx/networkx/algorithms/reciprocity.pyi +++ b/stubs/networkx/networkx/algorithms/reciprocity.pyi @@ -1,8 +1,9 @@ -from _typeshed import Incomplete +from collections.abc import Iterable +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def reciprocity(G, nodes: Incomplete | None = None): ... +def reciprocity(G: Graph[_Node], nodes: Iterable[_Node] | None = None): ... @_dispatchable -def overall_reciprocity(G): ... +def overall_reciprocity(G: Graph[_Node]): ... diff --git a/stubs/networkx/networkx/algorithms/regular.pyi b/stubs/networkx/networkx/algorithms/regular.pyi index 1e66cfe1c92d..61a19ea04a3b 100644 --- a/stubs/networkx/networkx/algorithms/regular.pyi +++ b/stubs/networkx/networkx/algorithms/regular.pyi @@ -1,8 +1,9 @@ +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def is_regular(G): ... +def is_regular(G: Graph[_Node]): ... @_dispatchable -def is_k_regular(G, k): ... +def is_k_regular(G: Graph[_Node], k): ... @_dispatchable -def k_factor(G, k, matching_weight: str = "weight"): ... +def k_factor(G: Graph[_Node], k, matching_weight: str | None = "weight"): ... diff --git a/stubs/networkx/networkx/algorithms/richclub.pyi b/stubs/networkx/networkx/algorithms/richclub.pyi index fa8f1f06df26..2b7b8b21fb2c 100644 --- a/stubs/networkx/networkx/algorithms/richclub.pyi +++ b/stubs/networkx/networkx/algorithms/richclub.pyi @@ -1,6 +1,6 @@ -from _typeshed import Incomplete - +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable +from numpy.random import RandomState @_dispatchable -def rich_club_coefficient(G, normalized: bool = True, Q: float = 100, seed: Incomplete | None = None): ... +def rich_club_coefficient(G: Graph[_Node], normalized: bool = True, Q: float = 100, seed: int | RandomState | None = None): ... diff --git a/stubs/networkx/networkx/algorithms/shortest_paths/astar.pyi b/stubs/networkx/networkx/algorithms/shortest_paths/astar.pyi index 6b5160269014..63260ea30639 100644 --- a/stubs/networkx/networkx/algorithms/shortest_paths/astar.pyi +++ b/stubs/networkx/networkx/algorithms/shortest_paths/astar.pyi @@ -1,8 +1,27 @@ -from _typeshed import Incomplete +from _typeshed import Incomplete, SupportsGetItem +from collections.abc import Callable +from typing import Any +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def astar_path(G, source, target, heuristic: Incomplete | None = None, weight: str = "weight"): ... +def astar_path( + G: Graph[_Node], + source: _Node, + target: _Node, + heuristic: Callable[..., Incomplete] | None = None, + weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight", + *, + cutoff: float | None = None, +): ... @_dispatchable -def astar_path_length(G, source, target, heuristic: Incomplete | None = None, weight: str = "weight"): ... +def astar_path_length( + G: Graph[_Node], + source: _Node, + target: _Node, + heuristic: Callable[..., Incomplete] | None = None, + weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight", + *, + cutoff: float | None = None, +): ... diff --git a/stubs/networkx/networkx/algorithms/shortest_paths/dense.pyi b/stubs/networkx/networkx/algorithms/shortest_paths/dense.pyi index 355782732342..88e66d572eb0 100644 --- a/stubs/networkx/networkx/algorithms/shortest_paths/dense.pyi +++ b/stubs/networkx/networkx/algorithms/shortest_paths/dense.pyi @@ -1,12 +1,14 @@ -from _typeshed import Incomplete +from _typeshed import Incomplete, SupportsGetItem +from collections.abc import Iterable +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def floyd_warshall_numpy(G, nodelist: Incomplete | None = None, weight: str = "weight"): ... +def floyd_warshall_numpy(G: Graph[_Node], nodelist: Iterable[Incomplete] | None = None, weight: str | None = "weight"): ... @_dispatchable -def floyd_warshall_predecessor_and_distance(G, weight: str = "weight"): ... +def floyd_warshall_predecessor_and_distance(G: Graph[_Node], weight: str | None = "weight"): ... @_dispatchable -def reconstruct_path(source, target, predecessors): ... +def reconstruct_path(source: _Node, target: _Node, predecessors: SupportsGetItem[Incomplete, Incomplete]): ... @_dispatchable -def floyd_warshall(G, weight: str = "weight"): ... +def floyd_warshall(G: Graph[_Node], weight: str | None = "weight"): ... diff --git a/stubs/networkx/networkx/algorithms/shortest_paths/generic.pyi b/stubs/networkx/networkx/algorithms/shortest_paths/generic.pyi index 82723d3eb9e8..f623aeb9ee90 100644 --- a/stubs/networkx/networkx/algorithms/shortest_paths/generic.pyi +++ b/stubs/networkx/networkx/algorithms/shortest_paths/generic.pyi @@ -1,5 +1,5 @@ from _typeshed import Incomplete -from collections.abc import Generator +from collections.abc import Callable, Generator from typing import overload from networkx.classes.graph import Graph, _Node @@ -9,23 +9,45 @@ from networkx.utils.backends import _dispatchable def has_path(G: Graph[_Node], source: _Node, target: _Node) -> bool: ... @overload def shortest_path( - G: Graph[_Node], source: _Node, target: _Node, weight: Incomplete | None = None, method: str = "dijkstra" + G: Graph[_Node], + source: _Node | None = None, + target: _Node | None = None, + weight: str | Callable[..., Incomplete] | None = None, + method: str | None = "dijkstra", ) -> list[_Node]: ... @overload -def shortest_path(G: Graph[_Node], target: _Node, method: str = "dijkstra") -> dict[_Node, list[_Node]]: ... +def shortest_path( + G: Graph[_Node], + source: _Node | None = None, + target: _Node | None = None, + weight: str | Callable[..., Incomplete] | None = None, + method: str | None = "dijkstra", +) -> dict[_Node, list[_Node]]: ... @overload -def shortest_path(G: Graph[_Node], source: _Node, method: str = "dijkstra") -> dict[_Node, list[_Node]]: ... +def shortest_path( + G: Graph[_Node], + source: _Node | None = None, + target: _Node | None = None, + weight: str | Callable[..., Incomplete] | None = None, + method: str | None = "dijkstra", +) -> dict[_Node, list[_Node]]: ... @_dispatchable def shortest_path_length( - G, - source: Incomplete | None = None, - target: Incomplete | None = None, - weight: Incomplete | None = None, - method: str = "dijkstra", + G: Graph[_Node], + source: _Node | None = None, + target: _Node | None = None, + weight: str | Callable[..., Incomplete] | None = None, + method: str | None = "dijkstra", ): ... @_dispatchable -def average_shortest_path_length(G, weight: Incomplete | None = None, method: str | None = None): ... +def average_shortest_path_length( + G: Graph[_Node], weight: str | Callable[..., Incomplete] | None = None, method: str | None = None +): ... @_dispatchable def all_shortest_paths( - G: Graph[_Node], source: _Node, target: _Node, weight: Incomplete | None = None, method: str = "dijkstra" + G: Graph[_Node], + source: _Node, + target: _Node, + weight: str | Callable[..., Incomplete] | None = None, + method: str | None = "dijkstra", ) -> Generator[list[_Node], None, None]: ... diff --git a/stubs/networkx/networkx/algorithms/shortest_paths/unweighted.pyi b/stubs/networkx/networkx/algorithms/shortest_paths/unweighted.pyi index cb4eeab99d23..8250e0f2c229 100644 --- a/stubs/networkx/networkx/algorithms/shortest_paths/unweighted.pyi +++ b/stubs/networkx/networkx/algorithms/shortest_paths/unweighted.pyi @@ -1,23 +1,24 @@ from _typeshed import Incomplete from collections.abc import Generator +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def single_source_shortest_path_length(G, source, cutoff: Incomplete | None = None): ... +def single_source_shortest_path_length(G: Graph[_Node], source: _Node, cutoff: int | None = None): ... @_dispatchable -def single_target_shortest_path_length(G, target, cutoff: Incomplete | None = None): ... +def single_target_shortest_path_length(G: Graph[_Node], target: _Node, cutoff: int | None = None): ... @_dispatchable -def all_pairs_shortest_path_length(G, cutoff: Incomplete | None = None) -> Generator[Incomplete, None, None]: ... +def all_pairs_shortest_path_length(G: Graph[_Node], cutoff: int | None = None) -> Generator[Incomplete, None, None]: ... @_dispatchable -def bidirectional_shortest_path(G, source, target): ... +def bidirectional_shortest_path(G: Graph[_Node], source: str, target: str): ... @_dispatchable -def single_source_shortest_path(G, source, cutoff: Incomplete | None = None): ... +def single_source_shortest_path(G: Graph[_Node], source: str, cutoff: int | None = None): ... @_dispatchable -def single_target_shortest_path(G, target, cutoff: Incomplete | None = None): ... +def single_target_shortest_path(G: Graph[_Node], target: str, cutoff: int | None = None): ... @_dispatchable -def all_pairs_shortest_path(G, cutoff: Incomplete | None = None) -> Generator[Incomplete, None, None]: ... +def all_pairs_shortest_path(G: Graph[_Node], cutoff: int | None = None) -> Generator[Incomplete, None, None]: ... @_dispatchable def predecessor( - G, source, target: Incomplete | None = None, cutoff: Incomplete | None = None, return_seen: Incomplete | None = None + G: Graph[_Node], source: str, target: str | None = None, cutoff: int | None = None, return_seen: bool | None = None ): ... diff --git a/stubs/networkx/networkx/algorithms/shortest_paths/weighted.pyi b/stubs/networkx/networkx/algorithms/shortest_paths/weighted.pyi index 2716cbfbc84c..8c898e28bff5 100644 --- a/stubs/networkx/networkx/algorithms/shortest_paths/weighted.pyi +++ b/stubs/networkx/networkx/algorithms/shortest_paths/weighted.pyi @@ -1,72 +1,158 @@ -from _typeshed import Incomplete +from _typeshed import Incomplete, SupportsGetItem from collections.abc import Callable, Generator from typing import Any -from typing_extensions import TypeAlias +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable -# type alias for the weight function -_WeightFunction: TypeAlias = Callable[[Any, Any, dict[str, Any]], float | None] - @_dispatchable -def dijkstra_path(G, source, target, weight: str | _WeightFunction = "weight"): ... +def dijkstra_path( + G: Graph[_Node], + source: _Node, + target: _Node, + weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight", +): ... @_dispatchable -def dijkstra_path_length(G, source, target, weight: str | _WeightFunction = "weight"): ... +def dijkstra_path_length( + G: Graph[_Node], + source: str, + target: str, + weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight", +): ... @_dispatchable -def single_source_dijkstra_path(G, source, cutoff: Incomplete | None = None, weight: str | _WeightFunction = "weight"): ... +def single_source_dijkstra_path( + G: Graph[_Node], + source: _Node, + cutoff: float | None = None, + weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight", +): ... @_dispatchable -def single_source_dijkstra_path_length(G, source, cutoff: Incomplete | None = None, weight: str | _WeightFunction = "weight"): ... +def single_source_dijkstra_path_length( + G: Graph[_Node], + source: str, + cutoff: float | None = None, + weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight", +): ... @_dispatchable def single_source_dijkstra( - G, source, target: Incomplete | None = None, cutoff: Incomplete | None = None, weight: str | _WeightFunction = "weight" + G: Graph[_Node], + source: str, + target: str | None = None, + cutoff: float | None = None, + weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight", ): ... @_dispatchable -def multi_source_dijkstra_path(G, sources, cutoff: Incomplete | None = None, weight: str | _WeightFunction = "weight"): ... +def multi_source_dijkstra_path( + G: Graph[_Node], + sources, + cutoff: float | None = None, + weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight", +): ... @_dispatchable -def multi_source_dijkstra_path_length(G, sources, cutoff: Incomplete | None = None, weight: str | _WeightFunction = "weight"): ... +def multi_source_dijkstra_path_length( + G: Graph[_Node], + sources, + cutoff: float | None = None, + weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight", +): ... @_dispatchable def multi_source_dijkstra( - G, sources, target: Incomplete | None = None, cutoff: Incomplete | None = None, weight: str | _WeightFunction = "weight" + G: Graph[_Node], + sources, + target: str | None = None, + cutoff: float | None = None, + weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight", ): ... @_dispatchable -def dijkstra_predecessor_and_distance(G, source, cutoff: Incomplete | None = None, weight: str | _WeightFunction = "weight"): ... +def dijkstra_predecessor_and_distance( + G: Graph[_Node], + source: str, + cutoff: float | None = None, + weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight", +): ... @_dispatchable def all_pairs_dijkstra( - G, cutoff: Incomplete | None = None, weight: str | _WeightFunction = "weight" + G: Graph[_Node], + cutoff: float | None = None, + weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight", ) -> Generator[Incomplete, None, None]: ... @_dispatchable def all_pairs_dijkstra_path_length( - G, cutoff: Incomplete | None = None, weight: str | _WeightFunction = "weight" + G: Graph[_Node], + cutoff: float | None = None, + weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight", ) -> Generator[Incomplete, None, None]: ... @_dispatchable def all_pairs_dijkstra_path( - G, cutoff: Incomplete | None = None, weight: str | _WeightFunction = "weight" + G: Graph[_Node], + cutoff: float | None = None, + weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight", ) -> Generator[Incomplete, None, None]: ... @_dispatchable def bellman_ford_predecessor_and_distance( - G, source, target: Incomplete | None = None, weight: str | _WeightFunction = "weight", heuristic: bool = False + G: Graph[_Node], + source: str, + target: str | None = None, + weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight", + heuristic: bool = False, ): ... @_dispatchable -def bellman_ford_path(G, source, target, weight: str | _WeightFunction = "weight"): ... +def bellman_ford_path( + G: Graph[_Node], + source: _Node, + target: _Node, + weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight", +): ... @_dispatchable -def bellman_ford_path_length(G, source, target, weight: str | _WeightFunction = "weight"): ... +def bellman_ford_path_length( + G: Graph[_Node], + source: str, + target: str, + weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight", +): ... @_dispatchable -def single_source_bellman_ford_path(G, source, weight: str | _WeightFunction = "weight"): ... +def single_source_bellman_ford_path( + G: Graph[_Node], source: _Node, weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight" +): ... @_dispatchable -def single_source_bellman_ford_path_length(G, source, weight: str | _WeightFunction = "weight"): ... +def single_source_bellman_ford_path_length( + G: Graph[_Node], source: str, weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight" +): ... @_dispatchable -def single_source_bellman_ford(G, source, target: Incomplete | None = None, weight: str | _WeightFunction = "weight"): ... +def single_source_bellman_ford( + G: Graph[_Node], + source: str, + target: str | None = None, + weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight", +): ... @_dispatchable -def all_pairs_bellman_ford_path_length(G, weight: str | _WeightFunction = "weight") -> Generator[Incomplete, None, None]: ... +def all_pairs_bellman_ford_path_length( + G: Graph[_Node], weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight" +) -> Generator[Incomplete, None, None]: ... @_dispatchable -def all_pairs_bellman_ford_path(G, weight: str | _WeightFunction = "weight") -> Generator[Incomplete, None, None]: ... +def all_pairs_bellman_ford_path( + G: Graph[_Node], weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight" +) -> Generator[Incomplete, None, None]: ... @_dispatchable -def goldberg_radzik(G, source, weight: str | _WeightFunction = "weight"): ... +def goldberg_radzik( + G: Graph[_Node], source: str, weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight" +): ... @_dispatchable -def negative_edge_cycle(G, weight: str | _WeightFunction = "weight", heuristic: bool = True): ... +def negative_edge_cycle( + G: Graph[_Node], + weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight", + heuristic: bool = True, +): ... @_dispatchable -def find_negative_cycle(G, source, weight: str | _WeightFunction = "weight"): ... +def find_negative_cycle( + G: Graph[_Node], source: str, weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight" +): ... @_dispatchable -def bidirectional_dijkstra(G, source, target, weight: str | _WeightFunction = "weight"): ... +def bidirectional_dijkstra( + G: Graph[_Node], + source: _Node, + target: _Node, + weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight", +): ... @_dispatchable -def johnson(G, weight: str | _WeightFunction = "weight"): ... +def johnson(G: Graph[_Node], weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight"): ... diff --git a/stubs/networkx/networkx/algorithms/similarity.pyi b/stubs/networkx/networkx/algorithms/similarity.pyi index bec692662f97..92164d71d9d8 100644 --- a/stubs/networkx/networkx/algorithms/similarity.pyi +++ b/stubs/networkx/networkx/algorithms/similarity.pyi @@ -1,83 +1,97 @@ -from _typeshed import Incomplete -from collections.abc import Generator +from _typeshed import Incomplete, SupportsGetItem +from collections.abc import Callable, Generator +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable +from numpy.random import RandomState @_dispatchable def graph_edit_distance( - G1, - G2, - node_match: Incomplete | None = None, - edge_match: Incomplete | None = None, - node_subst_cost: Incomplete | None = None, - node_del_cost: Incomplete | None = None, - node_ins_cost: Incomplete | None = None, - edge_subst_cost: Incomplete | None = None, - edge_del_cost: Incomplete | None = None, - edge_ins_cost: Incomplete | None = None, - roots: Incomplete | None = None, - upper_bound: Incomplete | None = None, - timeout: Incomplete | None = None, + G1: Graph[_Node], + G2: Graph[_Node], + node_match: Callable[..., Incomplete] | None = None, + edge_match: Callable[..., Incomplete] | None = None, + node_subst_cost: Callable[..., Incomplete] | None = None, + node_del_cost: Callable[..., Incomplete] | None = None, + node_ins_cost: Callable[..., Incomplete] | None = None, + edge_subst_cost: Callable[..., Incomplete] | None = None, + edge_del_cost: Callable[..., Incomplete] | None = None, + edge_ins_cost: Callable[..., Incomplete] | None = None, + roots=None, + upper_bound: float | None = None, + timeout: float | None = None, ): ... @_dispatchable def optimal_edit_paths( - G1, - G2, - node_match: Incomplete | None = None, - edge_match: Incomplete | None = None, - node_subst_cost: Incomplete | None = None, - node_del_cost: Incomplete | None = None, - node_ins_cost: Incomplete | None = None, - edge_subst_cost: Incomplete | None = None, - edge_del_cost: Incomplete | None = None, - edge_ins_cost: Incomplete | None = None, - upper_bound: Incomplete | None = None, + G1: Graph[_Node], + G2: Graph[_Node], + node_match: Callable[..., Incomplete] | None = None, + edge_match: Callable[..., Incomplete] | None = None, + node_subst_cost: Callable[..., Incomplete] | None = None, + node_del_cost: Callable[..., Incomplete] | None = None, + node_ins_cost: Callable[..., Incomplete] | None = None, + edge_subst_cost: Callable[..., Incomplete] | None = None, + edge_del_cost: Callable[..., Incomplete] | None = None, + edge_ins_cost: Callable[..., Incomplete] | None = None, + upper_bound: float | None = None, ): ... @_dispatchable def optimize_graph_edit_distance( - G1, - G2, - node_match: Incomplete | None = None, - edge_match: Incomplete | None = None, - node_subst_cost: Incomplete | None = None, - node_del_cost: Incomplete | None = None, - node_ins_cost: Incomplete | None = None, - edge_subst_cost: Incomplete | None = None, - edge_del_cost: Incomplete | None = None, - edge_ins_cost: Incomplete | None = None, - upper_bound: Incomplete | None = None, + G1: Graph[_Node], + G2: Graph[_Node], + node_match: Callable[..., Incomplete] | None = None, + edge_match: Callable[..., Incomplete] | None = None, + node_subst_cost: Callable[..., Incomplete] | None = None, + node_del_cost: Callable[..., Incomplete] | None = None, + node_ins_cost: Callable[..., Incomplete] | None = None, + edge_subst_cost: Callable[..., Incomplete] | None = None, + edge_del_cost: Callable[..., Incomplete] | None = None, + edge_ins_cost: Callable[..., Incomplete] | None = None, + upper_bound: float | None = None, ) -> Generator[Incomplete, None, None]: ... @_dispatchable def optimize_edit_paths( - G1, - G2, - node_match: Incomplete | None = None, - edge_match: Incomplete | None = None, - node_subst_cost: Incomplete | None = None, - node_del_cost: Incomplete | None = None, - node_ins_cost: Incomplete | None = None, - edge_subst_cost: Incomplete | None = None, - edge_del_cost: Incomplete | None = None, - edge_ins_cost: Incomplete | None = None, - upper_bound: Incomplete | None = None, + G1: Graph[_Node], + G2: Graph[_Node], + node_match: Callable[..., Incomplete] | None = None, + edge_match: Callable[..., Incomplete] | None = None, + node_subst_cost: Callable[..., Incomplete] | None = None, + node_del_cost: Callable[..., Incomplete] | None = None, + node_ins_cost: Callable[..., Incomplete] | None = None, + edge_subst_cost: Callable[..., Incomplete] | None = None, + edge_del_cost: Callable[..., Incomplete] | None = None, + edge_ins_cost: Callable[..., Incomplete] | None = None, + upper_bound: float | None = None, strictly_decreasing: bool = True, - roots: Incomplete | None = None, - timeout: Incomplete | None = None, + roots=None, + timeout: float | None = None, ) -> Generator[Incomplete, None, Incomplete]: ... @_dispatchable def simrank_similarity( - G, - source: Incomplete | None = None, - target: Incomplete | None = None, + G: Graph[_Node], + source: _Node | None = None, + target: _Node | None = None, importance_factor: float = 0.9, max_iterations: int = 1000, tolerance: float = 0.0001, ): ... @_dispatchable def panther_similarity( - G, source, k: int = 5, path_length: int = 5, c: float = 0.5, delta: float = 0.1, eps: Incomplete | None = None + G: Graph[_Node], + source: _Node, + k: int = 5, + path_length: int = 5, + c: float = 0.5, + delta: float = 0.1, + eps=None, + weight: str | None = "weight", ): ... @_dispatchable def generate_random_paths( - G, sample_size, path_length: int = 5, index_map: Incomplete | None = None + G: Graph[_Node], + sample_size: int, + path_length: int = 5, + index_map: SupportsGetItem[Incomplete, Incomplete] | None = None, + weight: str | None = "weight", + seed: int | RandomState | None = None, ) -> Generator[Incomplete, None, None]: ... diff --git a/stubs/networkx/networkx/algorithms/simple_paths.pyi b/stubs/networkx/networkx/algorithms/simple_paths.pyi index 6e69d1d1386e..a33ebdbb3bdc 100644 --- a/stubs/networkx/networkx/algorithms/simple_paths.pyi +++ b/stubs/networkx/networkx/algorithms/simple_paths.pyi @@ -1,5 +1,6 @@ -from _typeshed import Incomplete -from collections.abc import Generator, Sequence +from _typeshed import Incomplete, SupportsGetItem +from collections.abc import Callable, Generator, Iterable +from typing import Any from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @@ -7,24 +8,26 @@ from networkx.utils.backends import _dispatchable __all__ = ["all_simple_paths", "is_simple_path", "shortest_simple_paths", "all_simple_edge_paths"] @_dispatchable -def is_simple_path(G: Graph[_Node], nodes: Sequence[_Node]): ... +def is_simple_path(G: Graph[_Node], nodes: Iterable[Incomplete]): ... @_dispatchable -def all_simple_paths( - G: Graph[_Node], source: _Node, target: _Node, cutoff: Incomplete | None = None -) -> Generator[list[_Node], None, None]: ... +def all_simple_paths(G: Graph[_Node], source: _Node, target, cutoff: int | None = None) -> Generator[list[_Node], None, None]: ... @_dispatchable def all_simple_edge_paths( - G: Graph[_Node], source: _Node, target: _Node, cutoff: Incomplete | None = None + G: Graph[_Node], source: _Node, target, cutoff: int | None = None ) -> Generator[list[_Node] | list[tuple[_Node, _Node]], None, list[_Node] | None]: ... @_dispatchable def shortest_simple_paths( - G: Graph[_Node], source: _Node, target: _Node, weight: Incomplete | None = None + G: Graph[_Node], + source: _Node, + target: _Node, + weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = None, ) -> Generator[list[_Node], None, None]: ... class PathBuffer: paths: Incomplete sortedpaths: Incomplete counter: Incomplete + def __init__(self) -> None: ... def __len__(self): ... def push(self, cost, path) -> None: ... diff --git a/stubs/networkx/networkx/algorithms/smallworld.pyi b/stubs/networkx/networkx/algorithms/smallworld.pyi index cb9c7b252e04..1489f56198ae 100644 --- a/stubs/networkx/networkx/algorithms/smallworld.pyi +++ b/stubs/networkx/networkx/algorithms/smallworld.pyi @@ -1,14 +1,14 @@ -from _typeshed import Incomplete - +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable +from numpy.random import RandomState @_dispatchable -def random_reference(G, niter: int = 1, connectivity: bool = True, seed: Incomplete | None = None): ... +def random_reference(G: Graph[_Node], niter: int = 1, connectivity: bool = True, seed: int | RandomState | None = None): ... @_dispatchable def lattice_reference( - G, niter: int = 5, D: Incomplete | None = None, connectivity: bool = True, seed: Incomplete | None = None + G: Graph[_Node], niter: int = 5, D=None, connectivity: bool = True, seed: int | RandomState | None = None ): ... @_dispatchable -def sigma(G, niter: int = 100, nrand: int = 10, seed: Incomplete | None = None): ... +def sigma(G: Graph[_Node], niter: int = 100, nrand: int = 10, seed: int | RandomState | None = None): ... @_dispatchable -def omega(G, niter: int = 5, nrand: int = 10, seed: Incomplete | None = None): ... +def omega(G: Graph[_Node], niter: int = 5, nrand: int = 10, seed: int | RandomState | None = None): ... diff --git a/stubs/networkx/networkx/algorithms/smetric.pyi b/stubs/networkx/networkx/algorithms/smetric.pyi index 61eb1aebdb14..ee2e7115e94a 100644 --- a/stubs/networkx/networkx/algorithms/smetric.pyi +++ b/stubs/networkx/networkx/algorithms/smetric.pyi @@ -1,4 +1,5 @@ +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def s_metric(G, normalized: bool = True): ... +def s_metric(G: Graph[_Node]): ... diff --git a/stubs/networkx/networkx/algorithms/sparsifiers.pyi b/stubs/networkx/networkx/algorithms/sparsifiers.pyi index e556626f172a..e2c456c9c1c1 100644 --- a/stubs/networkx/networkx/algorithms/sparsifiers.pyi +++ b/stubs/networkx/networkx/algorithms/sparsifiers.pyi @@ -1,6 +1,6 @@ -from _typeshed import Incomplete - +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable +from numpy.random import RandomState @_dispatchable -def spanner(G, stretch, weight: Incomplete | None = None, seed: Incomplete | None = None): ... +def spanner(G: Graph[_Node], stretch: float, weight: str | None = None, seed: int | RandomState | None = None): ... diff --git a/stubs/networkx/networkx/algorithms/structuralholes.pyi b/stubs/networkx/networkx/algorithms/structuralholes.pyi index bc396853a637..76e026c4415d 100644 --- a/stubs/networkx/networkx/algorithms/structuralholes.pyi +++ b/stubs/networkx/networkx/algorithms/structuralholes.pyi @@ -1,10 +1,12 @@ from _typeshed import Incomplete +from collections.abc import Iterable +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def effective_size(G, nodes: Incomplete | None = None, weight: Incomplete | None = None): ... +def effective_size(G: Graph[_Node], nodes: Iterable[Incomplete] | None = None, weight: str | None = None): ... @_dispatchable -def constraint(G, nodes: Incomplete | None = None, weight: Incomplete | None = None): ... +def constraint(G: Graph[_Node], nodes: Iterable[Incomplete] | None = None, weight: str | None = None): ... @_dispatchable -def local_constraint(G, u, v, weight: Incomplete | None = None): ... +def local_constraint(G: Graph[_Node], u: _Node, v: _Node, weight: str | None = None): ... diff --git a/stubs/networkx/networkx/algorithms/summarization.pyi b/stubs/networkx/networkx/algorithms/summarization.pyi index e1a359b8c72d..05116996663b 100644 --- a/stubs/networkx/networkx/algorithms/summarization.pyi +++ b/stubs/networkx/networkx/algorithms/summarization.pyi @@ -1,14 +1,16 @@ from _typeshed import Incomplete +from collections.abc import Iterable +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def dedensify(G, threshold, prefix: Incomplete | None = None, copy: bool = True): ... +def dedensify(G: Graph[_Node], threshold: int, prefix=None, copy: bool | None = True): ... @_dispatchable def snap_aggregation( - G, + G: Graph[_Node], node_attributes, - edge_attributes=(), + edge_attributes: Iterable[Incomplete] | None = (), prefix: str = "Supernode-", supernode_attribute: str = "group", superedge_attribute: str = "types", diff --git a/stubs/networkx/networkx/algorithms/swap.pyi b/stubs/networkx/networkx/algorithms/swap.pyi index be15bb2236fd..006bb38c9cd0 100644 --- a/stubs/networkx/networkx/algorithms/swap.pyi +++ b/stubs/networkx/networkx/algorithms/swap.pyi @@ -1,10 +1,13 @@ -from _typeshed import Incomplete - +from networkx.classes.digraph import DiGraph +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable +from numpy.random import RandomState @_dispatchable -def directed_edge_swap(G, *, nswap: int = 1, max_tries: int = 100, seed: Incomplete | None = None): ... +def directed_edge_swap(G: DiGraph[_Node], *, nswap: int = 1, max_tries: int = 100, seed: int | RandomState | None = None): ... @_dispatchable -def double_edge_swap(G, nswap: int = 1, max_tries: int = 100, seed: Incomplete | None = None): ... +def double_edge_swap(G: Graph[_Node], nswap: int = 1, max_tries: int = 100, seed: int | RandomState | None = None): ... @_dispatchable -def connected_double_edge_swap(G, nswap: int = 1, _window_threshold: int = 3, seed: Incomplete | None = None): ... +def connected_double_edge_swap( + G: Graph[_Node], nswap: int = 1, _window_threshold: int = 3, seed: int | RandomState | None = None +): ... diff --git a/stubs/networkx/networkx/algorithms/threshold.pyi b/stubs/networkx/networkx/algorithms/threshold.pyi index 4649c6638d33..8a06957f891a 100644 --- a/stubs/networkx/networkx/algorithms/threshold.pyi +++ b/stubs/networkx/networkx/algorithms/threshold.pyi @@ -1,8 +1,7 @@ -from _typeshed import Incomplete - +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def is_threshold_graph(G): ... +def is_threshold_graph(G: Graph[_Node]): ... @_dispatchable -def find_threshold_graph(G, create_using: Incomplete | None = None): ... +def find_threshold_graph(G: Graph[_Node], create_using: Graph[_Node] | None = None): ... diff --git a/stubs/networkx/networkx/algorithms/time_dependent.pyi b/stubs/networkx/networkx/algorithms/time_dependent.pyi new file mode 100644 index 000000000000..4a77f32bb5dc --- /dev/null +++ b/stubs/networkx/networkx/algorithms/time_dependent.pyi @@ -0,0 +1,5 @@ +from networkx.classes.graph import Graph, _Node +from networkx.utils.backends import _dispatchable + +@_dispatchable +def cd_index(G: Graph[_Node], node: _Node, time_delta, *, time: str = "time", weight: str | None = None): ... diff --git a/stubs/networkx/networkx/algorithms/tournament.pyi b/stubs/networkx/networkx/algorithms/tournament.pyi index a8f06989d1a2..9d92b1a46429 100644 --- a/stubs/networkx/networkx/algorithms/tournament.pyi +++ b/stubs/networkx/networkx/algorithms/tournament.pyi @@ -1,16 +1,16 @@ -from _typeshed import Incomplete - +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable +from numpy.random import RandomState @_dispatchable -def is_tournament(G): ... +def is_tournament(G: Graph[_Node]): ... @_dispatchable -def hamiltonian_path(G): ... +def hamiltonian_path(G: Graph[_Node]): ... @_dispatchable -def random_tournament(n, seed: Incomplete | None = None): ... +def random_tournament(n: int, seed: int | RandomState | None = None): ... @_dispatchable -def score_sequence(G): ... +def score_sequence(G: Graph[_Node]): ... @_dispatchable -def is_reachable(G, s, t): ... +def is_reachable(G: Graph[_Node], s: _Node, t: _Node): ... @_dispatchable -def is_strongly_connected(G): ... +def is_strongly_connected(G: Graph[_Node]): ... diff --git a/stubs/networkx/networkx/algorithms/traversal/beamsearch.pyi b/stubs/networkx/networkx/algorithms/traversal/beamsearch.pyi index 057bc9e8972d..7040e297b596 100644 --- a/stubs/networkx/networkx/algorithms/traversal/beamsearch.pyi +++ b/stubs/networkx/networkx/algorithms/traversal/beamsearch.pyi @@ -1,7 +1,10 @@ from _typeshed import Incomplete -from collections.abc import Generator +from collections.abc import Callable, Generator +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def bfs_beam_edges(G, source, value, width: Incomplete | None = None) -> Generator[Incomplete, Incomplete, Incomplete]: ... +def bfs_beam_edges( + G: Graph[_Node], source: _Node, value: Callable[..., Incomplete], width: int | None = None +) -> Generator[Incomplete, Incomplete, Incomplete]: ... diff --git a/stubs/networkx/networkx/algorithms/traversal/breadth_first_search.pyi b/stubs/networkx/networkx/algorithms/traversal/breadth_first_search.pyi index dbcf268d599c..9832210f2917 100644 --- a/stubs/networkx/networkx/algorithms/traversal/breadth_first_search.pyi +++ b/stubs/networkx/networkx/algorithms/traversal/breadth_first_search.pyi @@ -1,25 +1,34 @@ from _typeshed import Incomplete -from collections.abc import Generator +from collections.abc import Callable, Generator +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable def bfs_edges( - G, source, reverse: bool = False, depth_limit: Incomplete | None = None, sort_neighbors: Incomplete | None = None + G: Graph[_Node], + source: _Node, + reverse: bool | None = False, + depth_limit=None, + sort_neighbors: Callable[..., Incomplete] | None = None, ) -> Generator[Incomplete, Incomplete, None]: ... @_dispatchable def bfs_tree( - G, source, reverse: bool = False, depth_limit: Incomplete | None = None, sort_neighbors: Incomplete | None = None + G: Graph[_Node], + source: _Node, + reverse: bool | None = False, + depth_limit=None, + sort_neighbors: Callable[..., Incomplete] | None = None, ): ... @_dispatchable def bfs_predecessors( - G, source, depth_limit: Incomplete | None = None, sort_neighbors: Incomplete | None = None + G: Graph[_Node], source: _Node, depth_limit=None, sort_neighbors: Callable[..., Incomplete] | None = None ) -> Generator[Incomplete, None, None]: ... @_dispatchable def bfs_successors( - G, source, depth_limit: Incomplete | None = None, sort_neighbors: Incomplete | None = None + G: Graph[_Node], source: _Node, depth_limit=None, sort_neighbors: Callable[..., Incomplete] | None = None ) -> Generator[Incomplete, None, None]: ... @_dispatchable -def bfs_layers(G, sources) -> Generator[Incomplete, None, None]: ... +def bfs_layers(G: Graph[_Node], sources) -> Generator[Incomplete, None, None]: ... @_dispatchable -def descendants_at_distance(G, source, distance): ... +def descendants_at_distance(G: Graph[_Node], source, distance): ... diff --git a/stubs/networkx/networkx/algorithms/traversal/depth_first_search.pyi b/stubs/networkx/networkx/algorithms/traversal/depth_first_search.pyi index 0b1abaedf280..b4f3e1bc0a21 100644 --- a/stubs/networkx/networkx/algorithms/traversal/depth_first_search.pyi +++ b/stubs/networkx/networkx/algorithms/traversal/depth_first_search.pyi @@ -1,22 +1,34 @@ from _typeshed import Incomplete -from collections.abc import Generator +from collections.abc import Callable, Generator from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable def dfs_edges( - G: Graph[_Node], source: _Node | None = None, depth_limit: int | None = None + G: Graph[_Node], source: _Node | None = None, depth_limit=None, *, sort_neighbors: Callable[..., Incomplete] | None = None ) -> Generator[tuple[_Node, _Node], None, None]: ... @_dispatchable -def dfs_tree(G, source: Incomplete | None = None, depth_limit: Incomplete | None = None): ... +def dfs_tree( + G: Graph[_Node], source: _Node | None = None, depth_limit=None, *, sort_neighbors: Callable[..., Incomplete] | None = None +): ... @_dispatchable -def dfs_predecessors(G, source: Incomplete | None = None, depth_limit: Incomplete | None = None): ... +def dfs_predecessors( + G: Graph[_Node], source: _Node | None = None, depth_limit=None, *, sort_neighbors: Callable[..., Incomplete] | None = None +): ... @_dispatchable -def dfs_successors(G, source: Incomplete | None = None, depth_limit: Incomplete | None = None): ... +def dfs_successors( + G: Graph[_Node], source: _Node | None = None, depth_limit=None, *, sort_neighbors: Callable[..., Incomplete] | None = None +): ... @_dispatchable -def dfs_postorder_nodes(G, source: Incomplete | None = None, depth_limit: Incomplete | None = None): ... +def dfs_postorder_nodes( + G: Graph[_Node], source: _Node | None = None, depth_limit=None, *, sort_neighbors: Callable[..., Incomplete] | None = None +): ... @_dispatchable -def dfs_preorder_nodes(G, source: Incomplete | None = None, depth_limit: Incomplete | None = None): ... +def dfs_preorder_nodes( + G: Graph[_Node], source: _Node | None = None, depth_limit=None, *, sort_neighbors: Callable[..., Incomplete] | None = None +): ... @_dispatchable -def dfs_labeled_edges(G, source: Incomplete | None = None, depth_limit: Incomplete | None = None) -> None: ... +def dfs_labeled_edges( + G: Graph[_Node], source: _Node | None = None, depth_limit=None, *, sort_neighbors: Callable[..., Incomplete] | None = None +) -> None: ... diff --git a/stubs/networkx/networkx/algorithms/traversal/edgebfs.pyi b/stubs/networkx/networkx/algorithms/traversal/edgebfs.pyi index 4999e56ee880..1829e0bbe401 100644 --- a/stubs/networkx/networkx/algorithms/traversal/edgebfs.pyi +++ b/stubs/networkx/networkx/algorithms/traversal/edgebfs.pyi @@ -1,9 +1,8 @@ from _typeshed import Incomplete from collections.abc import Generator +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def edge_bfs( - G, source: Incomplete | None = None, orientation: Incomplete | None = None -) -> Generator[Incomplete, None, Incomplete]: ... +def edge_bfs(G: Graph[_Node], source=None, orientation=None) -> Generator[Incomplete, None, Incomplete]: ... diff --git a/stubs/networkx/networkx/algorithms/traversal/edgedfs.pyi b/stubs/networkx/networkx/algorithms/traversal/edgedfs.pyi index f2b11d4736f2..3e8b6485fd2d 100644 --- a/stubs/networkx/networkx/algorithms/traversal/edgedfs.pyi +++ b/stubs/networkx/networkx/algorithms/traversal/edgedfs.pyi @@ -1,9 +1,8 @@ from _typeshed import Incomplete from collections.abc import Generator +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def edge_dfs( - G, source: Incomplete | None = None, orientation: Incomplete | None = None -) -> Generator[Incomplete, None, Incomplete]: ... +def edge_dfs(G: Graph[_Node], source=None, orientation=None) -> Generator[Incomplete, None, Incomplete]: ... diff --git a/stubs/networkx/networkx/algorithms/tree/branchings.pyi b/stubs/networkx/networkx/algorithms/tree/branchings.pyi index 5bed2ab210ef..00a09bdafdbe 100644 --- a/stubs/networkx/networkx/algorithms/tree/branchings.pyi +++ b/stubs/networkx/networkx/algorithms/tree/branchings.pyi @@ -2,7 +2,10 @@ from _typeshed import Incomplete from collections.abc import Iterator from dataclasses import dataclass +from networkx.classes.digraph import DiGraph +from networkx.classes.graph import _Node from networkx.utils.backends import _dispatchable +from numpy.random import RandomState __all__ = [ "branching_weight", @@ -15,24 +18,26 @@ __all__ = [ ] @_dispatchable -def branching_weight(G, attr: str = "weight", default: float = 1): ... +def branching_weight(G: DiGraph[_Node], attr: str = "weight", default: float = 1): ... @_dispatchable -def greedy_branching(G, attr: str = "weight", default: float = 1, kind: str = "max", seed: Incomplete | None = None): ... +def greedy_branching( + G: DiGraph[_Node], attr: str = "weight", default: float = 1, kind: str = "max", seed: int | RandomState | None = None +): ... @_dispatchable def maximum_branching( - G, attr: str = "weight", default: float = 1, preserve_attrs: bool = False, partition: Incomplete | None = None + G: DiGraph[_Node], attr: str = "weight", default: float = 1, preserve_attrs: bool = False, partition: str | None = None ): ... @_dispatchable def minimum_branching( - G, attr: str = "weight", default: float = 1, preserve_attrs: bool = False, partition: Incomplete | None = None + G: DiGraph[_Node], attr: str = "weight", default: float = 1, preserve_attrs: bool = False, partition: str | None = None ): ... @_dispatchable def maximum_spanning_arborescence( - G, attr: str = "weight", default: float = 1, preserve_attrs: bool = False, partition: Incomplete | None = None + G: DiGraph[_Node], attr: str = "weight", default: float = 1, preserve_attrs: bool = False, partition: str | None = None ): ... @_dispatchable def minimum_spanning_arborescence( - G, attr: str = "weight", default: float = 1, preserve_attrs: bool = False, partition: Incomplete | None = None + G: DiGraph[_Node], attr: str = "weight", default: float = 1, preserve_attrs: bool = False, partition: str | None = None ): ... class ArborescenceIterator: @@ -47,7 +52,9 @@ class ArborescenceIterator: method: Incomplete partition_key: str init_partition: Incomplete + def __init__(self, G, weight: str = "weight", minimum: bool = True, init_partition: Incomplete | None = None) -> None: ... partition_queue: Incomplete + def __iter__(self) -> Iterator[Incomplete]: ... def __next__(self): ... diff --git a/stubs/networkx/networkx/algorithms/tree/coding.pyi b/stubs/networkx/networkx/algorithms/tree/coding.pyi index 180a04a7c1ac..14906e0ba3c3 100644 --- a/stubs/networkx/networkx/algorithms/tree/coding.pyi +++ b/stubs/networkx/networkx/algorithms/tree/coding.pyi @@ -1,13 +1,17 @@ +from _typeshed import Incomplete +from collections.abc import Iterable + +from networkx.classes.graph import Graph, _Node from networkx.exception import NetworkXException from networkx.utils.backends import _dispatchable class NotATree(NetworkXException): ... @_dispatchable -def to_nested_tuple(T, root, canonical_form: bool = False): ... +def to_nested_tuple(T: Graph[_Node], root: _Node, canonical_form: bool = False): ... @_dispatchable -def from_nested_tuple(sequence, sensible_relabeling: bool = False): ... +def from_nested_tuple(sequence: tuple[Incomplete], sensible_relabeling: bool = False): ... @_dispatchable -def to_prufer_sequence(T): ... +def to_prufer_sequence(T: Graph[_Node]): ... @_dispatchable -def from_prufer_sequence(sequence): ... +def from_prufer_sequence(sequence: Iterable[Incomplete]): ... diff --git a/stubs/networkx/networkx/algorithms/tree/mst.pyi b/stubs/networkx/networkx/algorithms/tree/mst.pyi index 178b5a771cb7..2a55ed99c20a 100644 --- a/stubs/networkx/networkx/algorithms/tree/mst.pyi +++ b/stubs/networkx/networkx/algorithms/tree/mst.pyi @@ -3,7 +3,9 @@ from collections.abc import Iterator from dataclasses import dataclass from enum import Enum +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable +from numpy.random import RandomState class EdgePartition(Enum): OPEN = 0 @@ -12,22 +14,34 @@ class EdgePartition(Enum): @_dispatchable def minimum_spanning_edges( - G, algorithm: str = "kruskal", weight: str = "weight", keys: bool = True, data: bool = True, ignore_nan: bool = False + G: Graph[_Node], + algorithm: str = "kruskal", + weight: str = "weight", + keys: bool = True, + data: bool | None = True, + ignore_nan: bool = False, ): ... @_dispatchable def maximum_spanning_edges( - G, algorithm: str = "kruskal", weight: str = "weight", keys: bool = True, data: bool = True, ignore_nan: bool = False + G: Graph[_Node], + algorithm: str = "kruskal", + weight: str = "weight", + keys: bool = True, + data: bool | None = True, + ignore_nan: bool = False, ): ... @_dispatchable -def minimum_spanning_tree(G, weight: str = "weight", algorithm: str = "kruskal", ignore_nan: bool = False): ... +def minimum_spanning_tree(G: Graph[_Node], weight: str = "weight", algorithm: str = "kruskal", ignore_nan: bool = False): ... @_dispatchable def partition_spanning_tree( - G, minimum: bool = True, weight: str = "weight", partition: str = "partition", ignore_nan: bool = False + G: Graph[_Node], minimum: bool = True, weight: str = "weight", partition: str = "partition", ignore_nan: bool = False ): ... @_dispatchable -def maximum_spanning_tree(G, weight: str = "weight", algorithm: str = "kruskal", ignore_nan: bool = False): ... +def maximum_spanning_tree(G: Graph[_Node], weight: str = "weight", algorithm: str = "kruskal", ignore_nan: bool = False): ... @_dispatchable -def random_spanning_tree(G, weight: Incomplete | None = None, *, multiplicative: bool = True, seed: Incomplete | None = None): ... +def random_spanning_tree( + G: Graph[_Node], weight: str | None = None, *, multiplicative=True, seed: int | RandomState | None = None +): ... class SpanningTreeIterator: @dataclass @@ -40,7 +54,9 @@ class SpanningTreeIterator: minimum: Incomplete ignore_nan: Incomplete partition_key: str + def __init__(self, G, weight: str = "weight", minimum: bool = True, ignore_nan: bool = False) -> None: ... partition_queue: Incomplete + def __iter__(self) -> Iterator[Incomplete]: ... def __next__(self): ... diff --git a/stubs/networkx/networkx/algorithms/tree/operations.pyi b/stubs/networkx/networkx/algorithms/tree/operations.pyi index feab02594790..a88e48eca6e1 100644 --- a/stubs/networkx/networkx/algorithms/tree/operations.pyi +++ b/stubs/networkx/networkx/algorithms/tree/operations.pyi @@ -1,6 +1,7 @@ from _typeshed import Incomplete +from collections.abc import Iterable from networkx.utils.backends import _dispatchable @_dispatchable -def join_trees(rooted_trees, label_attribute: Incomplete | None = None): ... +def join_trees(rooted_trees: Iterable[Incomplete], *, label_attribute: str | None = None, first_label: int | None = 0): ... diff --git a/stubs/networkx/networkx/algorithms/tree/recognition.pyi b/stubs/networkx/networkx/algorithms/tree/recognition.pyi index b5b303b66c81..219e48d02f33 100644 --- a/stubs/networkx/networkx/algorithms/tree/recognition.pyi +++ b/stubs/networkx/networkx/algorithms/tree/recognition.pyi @@ -1,10 +1,12 @@ +from networkx.classes.digraph import DiGraph +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def is_arborescence(G): ... +def is_arborescence(G: Graph[_Node]): ... @_dispatchable -def is_branching(G): ... +def is_branching(G: DiGraph[_Node]): ... @_dispatchable -def is_forest(G): ... +def is_forest(G: Graph[_Node]): ... @_dispatchable -def is_tree(G): ... +def is_tree(G: Graph[_Node]): ... diff --git a/stubs/networkx/networkx/algorithms/triads.pyi b/stubs/networkx/networkx/algorithms/triads.pyi index 510b01cbdf2a..d6bea369c744 100644 --- a/stubs/networkx/networkx/algorithms/triads.pyi +++ b/stubs/networkx/networkx/algorithms/triads.pyi @@ -1,19 +1,22 @@ from _typeshed import Incomplete -from collections.abc import Generator +from collections.abc import Generator, Iterable +from networkx.classes.digraph import DiGraph +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable +from numpy.random import RandomState @_dispatchable -def triadic_census(G, nodelist: Incomplete | None = None): ... +def triadic_census(G: DiGraph[_Node], nodelist: Iterable[Incomplete] | None = None): ... @_dispatchable -def is_triad(G): ... +def is_triad(G: Graph[_Node]): ... @_dispatchable -def all_triplets(G): ... +def all_triplets(G: DiGraph[_Node]): ... @_dispatchable -def all_triads(G) -> Generator[Incomplete, None, None]: ... +def all_triads(G: DiGraph[_Node]) -> Generator[Incomplete, None, None]: ... @_dispatchable -def triads_by_type(G): ... +def triads_by_type(G: DiGraph[_Node]): ... @_dispatchable -def triad_type(G): ... +def triad_type(G: DiGraph[_Node]): ... @_dispatchable -def random_triad(G, seed: Incomplete | None = None): ... +def random_triad(G: DiGraph[_Node], seed: int | RandomState | None = None): ... diff --git a/stubs/networkx/networkx/algorithms/vitality.pyi b/stubs/networkx/networkx/algorithms/vitality.pyi index 9a7cfcb2b64a..ec105de8f4be 100644 --- a/stubs/networkx/networkx/algorithms/vitality.pyi +++ b/stubs/networkx/networkx/algorithms/vitality.pyi @@ -1,8 +1,9 @@ from _typeshed import Incomplete +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable def closeness_vitality( - G, node: Incomplete | None = None, weight: Incomplete | None = None, wiener_index: Incomplete | None = None + G: Graph[_Node], node: Incomplete | None = None, weight: str | None = None, wiener_index: float | None = None ): ... diff --git a/stubs/networkx/networkx/algorithms/voronoi.pyi b/stubs/networkx/networkx/algorithms/voronoi.pyi index 6713ec759232..806b4b12656c 100644 --- a/stubs/networkx/networkx/algorithms/voronoi.pyi +++ b/stubs/networkx/networkx/algorithms/voronoi.pyi @@ -1,4 +1,13 @@ +from _typeshed import Incomplete, SupportsGetItem +from collections.abc import Callable +from typing import Any + +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def voronoi_cells(G, center_nodes, weight: str = "weight"): ... +def voronoi_cells( + G: Graph[_Node], + center_nodes: set[Incomplete], + weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight", +): ... diff --git a/stubs/networkx/networkx/algorithms/walks.pyi b/stubs/networkx/networkx/algorithms/walks.pyi new file mode 100644 index 000000000000..9c5d25a38a22 --- /dev/null +++ b/stubs/networkx/networkx/algorithms/walks.pyi @@ -0,0 +1,5 @@ +from networkx.classes.graph import Graph, _Node +from networkx.utils.backends import _dispatchable + +@_dispatchable +def number_of_walks(G: Graph[_Node], walk_length: int): ... diff --git a/stubs/networkx/networkx/algorithms/wiener.pyi b/stubs/networkx/networkx/algorithms/wiener.pyi index 1cff8ccd0f76..e55f890203a8 100644 --- a/stubs/networkx/networkx/algorithms/wiener.pyi +++ b/stubs/networkx/networkx/algorithms/wiener.pyi @@ -1,6 +1,5 @@ -from _typeshed import Incomplete - +from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @_dispatchable -def wiener_index(G, weight: Incomplete | None = None): ... +def wiener_index(G: Graph[_Node], weight: str | None = None): ... diff --git a/stubs/networkx/networkx/generators/__init__.pyi b/stubs/networkx/networkx/generators/__init__.pyi index c19ff74b7229..878faee7cacc 100644 --- a/stubs/networkx/networkx/generators/__init__.pyi +++ b/stubs/networkx/networkx/generators/__init__.pyi @@ -8,6 +8,7 @@ from networkx.generators.duplication import * from networkx.generators.ego import * from networkx.generators.expanders import * from networkx.generators.geometric import * +from networkx.generators.harary_graph import * from networkx.generators.internet_as_graphs import * from networkx.generators.intersection import * from networkx.generators.interval_graph import * @@ -23,5 +24,6 @@ from networkx.generators.social import * from networkx.generators.spectral_graph_forge import * from networkx.generators.stochastic import * from networkx.generators.sudoku import * +from networkx.generators.time_series import * from networkx.generators.trees import * from networkx.generators.triads import * diff --git a/stubs/networkx/networkx/generators/time_series.pyi b/stubs/networkx/networkx/generators/time_series.pyi new file mode 100644 index 000000000000..b5655e820964 --- /dev/null +++ b/stubs/networkx/networkx/generators/time_series.pyi @@ -0,0 +1,4 @@ +from networkx.utils.backends import _dispatchable + +@_dispatchable +def visibility_graph(series): ...