From f2096e1a65291eb969051ad208c57fda683daee9 Mon Sep 17 00:00:00 2001 From: donBarbos Date: Tue, 9 Dec 2025 23:32:50 +0400 Subject: [PATCH] [networkx] Update to 3.6.1 Closes: #15116 --- stubs/networkx/METADATA.toml | 2 +- .../networkx/algorithms/bipartite/matrix.pyi | 9 +++++++- .../algorithms/community/__init__.pyi | 2 +- .../algorithms/community/bipartitions.pyi | 22 +++++++++++++++++++ .../algorithms/community/kernighan_lin.pyi | 16 -------------- stubs/networkx/networkx/classes/graph.pyi | 2 +- .../networkx/networkx/classes/multigraph.pyi | 2 +- 7 files changed, 34 insertions(+), 21 deletions(-) create mode 100644 stubs/networkx/networkx/algorithms/community/bipartitions.pyi delete mode 100644 stubs/networkx/networkx/algorithms/community/kernighan_lin.pyi diff --git a/stubs/networkx/METADATA.toml b/stubs/networkx/METADATA.toml index 7a18e2f12f67..9259f40c5f97 100644 --- a/stubs/networkx/METADATA.toml +++ b/stubs/networkx/METADATA.toml @@ -1,4 +1,4 @@ -version = "3.6" +version = "3.6.1" upstream_repository = "https://github.com/networkx/networkx" # requires a version of numpy with a `py.typed` file requires = ["numpy>=1.20"] diff --git a/stubs/networkx/networkx/algorithms/bipartite/matrix.pyi b/stubs/networkx/networkx/algorithms/bipartite/matrix.pyi index b33fed570b98..1a94c1310801 100644 --- a/stubs/networkx/networkx/algorithms/bipartite/matrix.pyi +++ b/stubs/networkx/networkx/algorithms/bipartite/matrix.pyi @@ -16,4 +16,11 @@ def biadjacency_matrix( format="csr", ): ... # Return is a complex union of scipy classes depending on the format param @_dispatchable -def from_biadjacency_matrix(A, create_using: Graph[_Node] | None = None, edge_attribute: str = "weight"): ... +def from_biadjacency_matrix( + A, + create_using: Graph[_Node] | None = None, + edge_attribute: str = "weight", + *, + row_order: Iterable[Incomplete] | None = None, + column_order: Iterable[Incomplete] | None = None, +): ... diff --git a/stubs/networkx/networkx/algorithms/community/__init__.pyi b/stubs/networkx/networkx/algorithms/community/__init__.pyi index 2ac869a36add..dc44dd7c344e 100644 --- a/stubs/networkx/networkx/algorithms/community/__init__.pyi +++ b/stubs/networkx/networkx/algorithms/community/__init__.pyi @@ -1,9 +1,9 @@ from networkx.algorithms.community.asyn_fluid import * +from networkx.algorithms.community.bipartitions import * from networkx.algorithms.community.centrality import * from networkx.algorithms.community.community_utils import * from networkx.algorithms.community.divisive import * from networkx.algorithms.community.kclique import * -from networkx.algorithms.community.kernighan_lin import * from networkx.algorithms.community.label_propagation import * from networkx.algorithms.community.leiden import * from networkx.algorithms.community.local import * diff --git a/stubs/networkx/networkx/algorithms/community/bipartitions.pyi b/stubs/networkx/networkx/algorithms/community/bipartitions.pyi new file mode 100644 index 000000000000..991590f7dac1 --- /dev/null +++ b/stubs/networkx/networkx/algorithms/community/bipartitions.pyi @@ -0,0 +1,22 @@ +from _typeshed import Incomplete +from collections.abc import Iterable + +from networkx.algorithms.shortest_paths.weighted import _WeightFunc +from networkx.classes.graph import Graph, _Node +from networkx.utils.backends import _dispatchable +from numpy.random import RandomState + +__all__ = ["kernighan_lin_bisection", "spectral_modularity_bipartition", "greedy_node_swap_bipartition"] + +@_dispatchable +def kernighan_lin_bisection( + G: Graph[_Node], + partition: tuple[Iterable[Incomplete], Iterable[Incomplete]] | None = None, + max_iter: int = 10, + weight: str | _WeightFunc[_Node] = "weight", + seed: int | RandomState | None = None, +) -> tuple[set[Incomplete], set[Incomplete]]: ... +def spectral_modularity_bipartition(G: Graph[_Node]) -> tuple[set[Incomplete], set[Incomplete]]: ... +def greedy_node_swap_bipartition( + G: Graph[_Node], *, init_split: tuple[set[Incomplete], set[Incomplete]] | None = None, max_iter: int = 10 +) -> tuple[set[Incomplete], set[Incomplete]]: ... diff --git a/stubs/networkx/networkx/algorithms/community/kernighan_lin.pyi b/stubs/networkx/networkx/algorithms/community/kernighan_lin.pyi deleted file mode 100644 index 00133f83134e..000000000000 --- a/stubs/networkx/networkx/algorithms/community/kernighan_lin.pyi +++ /dev/null @@ -1,16 +0,0 @@ -from _typeshed import Incomplete - -from networkx.classes.graph import Graph, _Node -from networkx.utils.backends import _dispatchable -from numpy.random import RandomState - -__all__ = ["kernighan_lin_bisection"] - -@_dispatchable -def kernighan_lin_bisection( - 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/classes/graph.pyi b/stubs/networkx/networkx/classes/graph.pyi index 691bad813751..086c697e26a1 100644 --- a/stubs/networkx/networkx/classes/graph.pyi +++ b/stubs/networkx/networkx/classes/graph.pyi @@ -43,7 +43,7 @@ class Graph(Collection[_Node]): def to_undirected_class(self) -> type[Graph[_Node]]: ... # @_dispatchable adds `backend` argument, but this decorated is unsupported constructor type here # and __init__() ignores this argument - def __new__(cls, incoming_graph_data: _Data[_Node] | None = None, *, backend=None, **attr: Any) -> Self: ... + def __new__(cls, *args, backend=None, **kwargs) -> Self: ... def __init__(self, incoming_graph_data: _Data[_Node] | None = None, **attr: Any) -> None: ... # attr: key=value pairs @cached_property def adj(self) -> AdjacencyView[_Node, _Node, dict[str, Any]]: ... diff --git a/stubs/networkx/networkx/classes/multigraph.pyi b/stubs/networkx/networkx/classes/multigraph.pyi index 21a6e6cac931..ce68d24d34e8 100644 --- a/stubs/networkx/networkx/classes/multigraph.pyi +++ b/stubs/networkx/networkx/classes/multigraph.pyi @@ -24,7 +24,7 @@ class MultiGraph(Graph[_Node]): def to_undirected_class(self) -> type[MultiGraph[_Node]]: ... # @_dispatchable adds `backend` argument, but this decorated is unsupported constructor type here # and __init__() ignores this argument - def __new__(cls, incoming_graph_data=None, multigraph_input: bool | None = None, *, backend=None, **attr: Any) -> Self: ... + def __new__(cls, *args, backend=None, **kwargs) -> Self: ... def __init__(self, incoming_graph_data=None, multigraph_input: bool | None = None, **attr: Any) -> None: ... @cached_property def adj(self) -> MultiAdjacencyView[_Node, _Node, dict[str, Any]]: ... # data can be any type