PY-91392 Update typeshed version to 7ee1807de401359ff16cab195aeb9b2a6f2fd8b8

Closes PY-91392


(cherry picked from commit b448a00bf11dc23edf2e9bb8ae8bec63111e0799)

IJ-MR-216702

GitOrigin-RevId: 68f973eab510e9b7f2ebc1d1b4db4b80840a9d16
This commit is contained in:
PyCharm Automation Bot
2026-08-04 12:10:37 +00:00
committed by intellij-monorepo-bot
parent daf4bb71aa
commit 39bea173bb
181 changed files with 1484 additions and 591 deletions
+3 -1
View File
@@ -2,7 +2,9 @@
# Y: Flake8 is only used to run flake8-pyi, everything else is in Ruff
select = Y
# Ignore rules normally excluded by default
extend-ignore = Y090,Y091
# Also ignore Y041 (redundant (complex |) float | int), see
# https://github.com/python/typeshed/issues/16059
extend-ignore = Y041,Y090,Y091
per-file-ignores =
# Generated protobuf files:
# Y021: Include docstrings
+6
View File
@@ -97,3 +97,9 @@ requests as "not planned" with an explanation like this:
We gladly accept type stub contributions for third-party libraries that are published on PyPI in typeshed. To contribute a new library, please follow the steps outlined in [CONTRIBUTING.md](/python/typeshed/blob/main/CONTRIBUTING.md). The `create_baseline_stubs.py` script can be useful to create an initial version, suitable for inclusion in typeshed.
That said, we don't keep requests for third-party library stubs open, unless there are issues that need to be addressed before a PR can be opened. Therefore, I'm closing this issue.
### Asking to remove tests
Please remove the tests. In typeshed, we only add regression tests for functions and classes which are known to have caused complex problems in the past, or where stubs are difficult to get right. 100% test coverage for typeshed is neither necessary nor desirable, as it would lead to code duplication.
See [`tests/REGRESSION.md`](https://github.com/python/typeshed/blob/main/tests/REGRESSION.md) for more information.
@@ -40,6 +40,7 @@
"stubs/Flask-SocketIO",
"stubs/fpdf2",
"stubs/gdb",
"stubs/geojson",
"stubs/geopandas",
"stubs/google-cloud-ndb",
"stubs/grpcio-channelz/grpc_channelz/v1",
@@ -11,9 +11,9 @@ mypy-protobuf==5.1.0; python_version < "3.15"
packaging==26.2
pathspec>=1.1.1
pre-commit
ruff==0.15.20
# Required by create_baseline_stubs.py.
# stubdefaulter depends on libcst, which does not yet install cleanly on Python 3.15.
ruff==0.15.20
stubdefaulter==0.1.0; python_version < "3.15"
termcolor>=2.3
tomli==2.4.1; python_version < "3.11"
@@ -24,7 +24,6 @@ def foo(x: int, y: str) -> None:
root.after(1000, foo, 10, "lol")
root.after(1000, foo, 10, 10) # type: ignore
# Font size must be integer
label = tkinter.Label()
label.config(font=("", 12))
@@ -27,11 +27,9 @@ class BufferedProtocol(BaseProtocol):
class DatagramProtocol(BaseProtocol):
__slots__ = ()
def connection_made(self, transport: transports.DatagramTransport) -> None: ... # type: ignore[override]
# addr can be a tuple[int, int] for some unusual protocols like socket.AF_NETLINK.
# Use tuple[str | Any, int] to not cause typechecking issues on most usual cases.
# This could be improved by using tuple[AnyOf[str, int], int] if the AnyOf feature is accepted.
# See https://github.com/python/typing/issues/566
def datagram_received(self, data: bytes, addr: tuple[str | Any, int]) -> None: ...
# addr is a tuple[str, int] for IPv4 or tuple[str, int, int, int] for IPv6.
# It can also be a tuple[int, int] for unusual protocols like socket.AF_NETLINK.
def datagram_received(self, data: bytes, addr: tuple[Any, ...]) -> None: ...
def error_received(self, exc: Exception) -> None: ...
class SubprocessProtocol(BaseProtocol):
@@ -1,4 +1,4 @@
from _typeshed import Incomplete, SupportsGetItem, SupportsLenAndGetItem, Unused
from _typeshed import SupportsGetItem, SupportsLenAndGetItem, Unused
from abc import abstractmethod
from collections.abc import Iterable, Iterator, MutableSequence
from typing import ClassVar, Final, TypeAlias
@@ -48,7 +48,7 @@ class Base:
class Node(Base):
fixers_applied: MutableSequence[BaseFix] | None
# Is Unbound until set in refactor.RefactoringTool
future_features: frozenset[Incomplete]
future_features: frozenset[str]
# Is Unbound until set in pgen2.parse.Parser.pop
used_names: set[str]
def __init__(
@@ -3905,7 +3905,7 @@ class OptionMenu(Menubutton):
variable: StringVar,
value: str,
*values: str,
command: Callable[[StringVar], object] | None = ...,
command: Callable[[str], object] | None = ...,
name: str | None = None,
) -> None: ...
else:
@@ -3916,7 +3916,7 @@ class OptionMenu(Menubutton):
variable: StringVar,
value: str,
*values: str,
command: Callable[[StringVar], object] | None = ...,
command: Callable[[str], object] | None = ...,
) -> None: ...
# configure, config, cget are inherited from Menubutton
# destroy and __getitem__ are overridden, signature does not change
@@ -1,3 +1,2 @@
version = "~=1.3.1"
upstream-repository = "https://github.com/laurent-laporte-pro/deprecated"
dependencies = []
@@ -1,3 +1,3 @@
version = "5.6.*"
dependencies = ["Flask>=0.9"]
upstream-repository = "https://github.com/miguelgrinberg/flask-socketio"
dependencies = ["Flask>=0.9"]
@@ -1,2 +1,2 @@
version = "2.1.12"
version = "2.1.13"
upstream-repository = "https://github.com/NVIDIA/jetson-gpio"
@@ -1,6 +1,6 @@
version = "2.20.*"
upstream-repository = "https://github.com/pygments/pygments"
dependencies = ["types-docutils"]
optional-dependencies = ["types-docutils"]
partial-stub = true
[tool.stubtest]
@@ -1,6 +1,6 @@
version = "6.4.*"
dependencies = ["types-html5lib"]
upstream-repository = "https://github.com/mozilla/bleach"
dependencies = ["types-html5lib"]
[tool.stubtest]
extras = ["css"]
@@ -1,3 +1,3 @@
version = "0.4.*"
dependencies = ["click>=8.0.0"]
upstream-repository = "https://github.com/click-contrib/click-log"
dependencies = ["click>=8.0.0"]
@@ -1,3 +1,3 @@
version = "0.8.*"
dependencies = ["click>=8.0.0", "Flask>=2.3.2"]
upstream-repository = "https://github.com/fredrik-corneliusson/click-web"
dependencies = ["click>=8.0.0", "Flask>=2.3.2"]
@@ -1,3 +1,4 @@
version = "7.2.*"
upstream-repository = "https://github.com/docker/docker-py"
dependencies = ["types-paramiko", "types-requests", "urllib3>=2"]
dependencies = ["types-requests", "urllib3>=2"]
optional-dependencies = ["types-paramiko"]
@@ -0,0 +1,3 @@
# Stub missing OK, not part of public API
geojson.factory
geojson.examples
@@ -0,0 +1,2 @@
version = "3.3.0"
upstream-repository = "https://github.com/jazzband/geojson"
@@ -0,0 +1,28 @@
from geojson._version import __version__, __version_info__
from geojson.base import GeoJSON
from geojson.codec import GeoJSONEncoder, dump, dumps, load, loads
from geojson.feature import Feature, FeatureCollection
from geojson.geometry import GeometryCollection, LineString, MultiLineString, MultiPoint, MultiPolygon, Point, Polygon
from geojson.utils import coords, map_coords
__all__ = [
"dump",
"dumps",
"load",
"loads",
"GeoJSONEncoder",
"coords",
"map_coords",
"Point",
"LineString",
"Polygon",
"MultiLineString",
"MultiPoint",
"MultiPolygon",
"GeometryCollection",
"Feature",
"FeatureCollection",
"GeoJSON",
"__version__",
"__version_info__",
]
@@ -0,0 +1,2 @@
__version__: str
__version_info__: tuple[int, ...]
@@ -0,0 +1,17 @@
from _typeshed import Incomplete
from collections.abc import Iterable
from typing import Any
class GeoJSON(dict[str, Any]):
def __init__(self, iterable: Iterable[tuple[str, Any]] = (), **extra) -> None: ...
def __getattr__(self, name: str | int) -> Incomplete: ...
def __setattr__(self, name: str, value) -> None: ...
def __delattr__(self, name: str) -> None: ...
@property
def __geo_interface__(self) -> None | GeoJSON: ...
@classmethod
def to_instance(cls, ob, default=None, strict: bool = False) -> GeoJSON: ...
@property
def is_valid(self) -> bool: ...
def check_list_errors(self, checkFunc, lst) -> list[str] | None: ...
def errors(self) -> list[str] | None: ...
@@ -0,0 +1,33 @@
import json
from _typeshed import SupportsRead, SupportsWrite
from collections.abc import Callable
from typing import Any
from typing_extensions import Never
from geojson.base import GeoJSON
class GeoJSONEncoder(json.JSONEncoder):
def default(self, obj) -> GeoJSON: ...
def dump(
obj, fp: SupportsWrite[str], cls: type[json.JSONEncoder] | None = json.JSONEncoder, allow_nan: bool = False, **kwargs
) -> None: ...
def dumps(
obj, cls: type[json.JSONEncoder] | None = json.JSONEncoder, allow_nan: bool = False, ensure_ascii: bool = False, **kwargs
) -> str: ...
def load(
fp: SupportsRead[str],
cls: type[json.JSONDecoder] = json.JSONDecoder,
parse_constant: Callable[..., Never] = ...,
object_hook: Callable[[dict[str, Any]], GeoJSON] = GeoJSON.to_instance,
**kwargs,
) -> GeoJSON: ...
def loads(
s: str,
cls: type[json.JSONDecoder] = json.JSONDecoder,
parse_constant: Callable[..., Never] = ...,
object_hook: Callable[[dict[str, Any]], GeoJSON] = GeoJSON.to_instance,
**kwargs,
) -> GeoJSON: ...
PyGFPEncoder = GeoJSONEncoder
@@ -0,0 +1,15 @@
from typing import Any
from geojson.base import GeoJSON
from geojson.geometry import Geometry
class Feature(GeoJSON):
def __init__(
self, id: None | str | int = None, geometry: None | Geometry = None, properties: None | dict[str, Any] = None, **extra
) -> None: ...
def errors(self) -> list[str] | None: ...
class FeatureCollection(GeoJSON):
def __init__(self, features: list[Feature | Geometry], **extra) -> None: ...
def errors(self) -> list[str] | None: ...
def __getitem__(self, key: int | str) -> Feature: ...
@@ -0,0 +1,52 @@
from collections.abc import Sequence
from decimal import Decimal
from typing import Literal, TypeAlias
from geojson.base import GeoJSON
_InputCoord: TypeAlias = float | Decimal | Geometry | Sequence[_InputCoord]
_CleanCoord: TypeAlias = float | Decimal | list[_CleanCoord]
DEFAULT_PRECISION: Literal[6]
class Geometry(GeoJSON):
def __init__(
self,
coordinates: None | Sequence[_InputCoord] | Geometry = None,
validate: bool = False,
precision: None | int = None,
**extra,
) -> None: ...
@classmethod
def clean_coordinates(cls, coords: Sequence[_InputCoord] | Geometry, precision: int) -> list[_CleanCoord]: ...
class GeometryCollection(GeoJSON):
def __init__(self, geometries: Sequence[Geometry] | None = None, **extra) -> None: ...
def errors(self) -> list[str] | None: ...
def __getitem__(self, key) -> Geometry | tuple[()] | None: ...
def check_point(coord) -> str | None: ...
class Point(Geometry):
def errors(self) -> list[str] | None: ...
class MultiPoint(Geometry):
def errors(self) -> list[str] | None: ...
def check_line_string(coord) -> str | None: ...
class LineString(Geometry):
def errors(self) -> list[str] | None: ...
class MultiLineString(MultiPoint):
def errors(self) -> list[str] | None: ...
def check_polygon(coord) -> str | None: ...
class Polygon(Geometry):
def errors(self) -> list[str] | None: ...
class MultiPolygon(Geometry):
def errors(self) -> list[str] | None: ...
class Default: ...
@@ -0,0 +1,6 @@
from typing import Any, Literal
GEO_INTERFACE_MARKER: Literal["__geo_interface__"]
def is_mapping(obj) -> bool: ...
def to_mapping(obj) -> dict[str, Any]: ...
@@ -0,0 +1,16 @@
from _typeshed import Incomplete
from collections.abc import Callable, Generator
from typing import Any, Literal
from geojson.base import GeoJSON
from geojson.geometry import Geometry, LineString, Point, Polygon
def coords(obj: GeoJSON | dict[str, Any]) -> Generator[tuple[float]]: ...
def map_coords(func: Callable[[Incomplete], float | Geometry], obj: GeoJSON | dict[str, Any]) -> dict[str, Any]: ...
def map_tuples(func: Callable[[Incomplete], float | Geometry], obj: GeoJSON | dict[str, Any]) -> dict[str, Any]: ...
def map_geometries(func: Callable[[Incomplete], float | Geometry], obj: GeoJSON | dict[str, Any]) -> dict[str, Any]: ...
def generate_random(
featureType: Literal["Point", "LineString", "Polygon"],
numberVertices: int = 3,
boundingBox: list[float] = [-180.0, -90.0, 180.0, 90.0],
) -> Point | LineString | Polygon: ...
@@ -1,7 +1,7 @@
# Requires a version of numpy with a `py.typed` file
version = "1.1.4"
dependencies = ["numpy>=1.20", "pandas-stubs", "types-shapely", "pyproj"]
upstream-repository = "https://github.com/geopandas/geopandas"
# Requires a version of numpy with a `py.typed` file
dependencies = ["numpy>=1.20", "pandas-stubs", "types-shapely", "pyproj"]
[tool.stubtest]
# libproj-dev and proj-bin are required to build pyproj if wheels for the
@@ -1,4 +1,4 @@
version = "~= 1.82.1"
version = "~= 1.83.0"
upstream-repository = "https://github.com/grpc/grpc"
partial-stub = true
@@ -28,6 +28,7 @@ from grpc import (
RpcError,
RpcMethodHandler,
ServerCredentials,
Status,
StatusCode,
_Options,
)
@@ -279,6 +280,8 @@ class ServicerContext(Generic[_TRequest, _TResponse], metaclass=abc.ABCMeta):
async def send_initial_metadata(self, initial_metadata: _MetadataType) -> None: ...
def add_done_callback(self, callback: _DoneCallback[_TRequest, _TResponse]) -> None: ...
@abc.abstractmethod
async def abort_with_status(self, status: Status) -> Never: ...
@abc.abstractmethod
def set_trailing_metadata(self, trailing_metadata: _MetadataType) -> None: ...
@abc.abstractmethod
def invocation_metadata(self) -> Metadata | None: ...
@@ -1,6 +1,6 @@
version = "26.0.0"
upstream-repository = "https://github.com/benoitc/gunicorn"
dependencies = ["types-gevent"]
optional-dependencies = ["types-gevent"]
[tool.stubtest]
supported-platforms = ["linux", "darwin"]
@@ -1,4 +1,9 @@
version = "0.8.*"
upstream-repository = "https://github.com/nmslib/hnswlib"
# Requires a version of numpy with a `py.typed` file
dependencies = ["numpy>=1.21"]
upstream-repository = "https://github.com/nmslib/hnswlib"
[tool.stubtest]
# TODO: stubtest fails on Linux because it gets killed with a SIGILL
# for unknown reasons. See https://github.com/python/typeshed/issues/16100
ci-platforms = ["darwin"]
@@ -1,3 +1,5 @@
from typing import Any
from hvac.api.vault_api_base import VaultApiBase
DEFAULT_MOUNT_POINT: str
@@ -6,6 +8,6 @@ class KvV1(VaultApiBase):
def read_secret(self, path: str, mount_point: str = "secret"): ...
def list_secrets(self, path: str, mount_point: str = "secret"): ...
def create_or_update_secret(
self, path: str, secret: dict[str, str], method: str | None = None, mount_point: str = "secret"
self, path: str, secret: dict[str, Any], method: str | None = None, mount_point: str = "secret"
): ...
def delete_secret(self, path: str, mount_point: str = "secret"): ...
@@ -1,3 +1,5 @@
from typing import Any
from hvac.api.vault_api_base import VaultApiBase
DEFAULT_MOUNT_POINT: str
@@ -15,7 +17,7 @@ class KvV2(VaultApiBase):
def read_secret_version(
self, path: str, version: int | None = None, mount_point: str = "secret", raise_on_deleted_version: bool | None = None
): ...
def create_or_update_secret(self, path: str, secret: dict[str, str], cas: int | None = None, mount_point: str = "secret"): ...
def create_or_update_secret(self, path: str, secret: dict[str, Any], cas: int | None = None, mount_point: str = "secret"): ...
def patch(self, path: str, secret: dict[str, str], mount_point: str = "secret"): ...
def delete_latest_version_of_secret(self, path: str, mount_point: str = "secret"): ...
def delete_secret_versions(self, path: str, versions: list[int], mount_point: str = "secret"): ...
@@ -5,4 +5,4 @@ from numpy.random import RandomState
__all__ = ["diameter"]
@_dispatchable
def diameter(G: Graph[_Node], seed: int | RandomState | None = None): ...
def diameter(G: Graph[_Node], seed: int | RandomState | None = None) -> int: ...
@@ -9,8 +9,8 @@ __all__ = ["randomized_partitioning", "one_exchange"]
@_dispatchable
def randomized_partitioning(
G: Graph[_Node], seed: int | RandomState | None = None, p: float = 0.5, weight: str | None = None
): ...
) -> tuple[float, tuple[set[Incomplete], set[Incomplete]]]: ...
@_dispatchable
def one_exchange(
G: Graph[_Node], initial_cut: set[Incomplete] | None = None, seed: int | RandomState | None = None, weight: str | None = None
): ...
) -> tuple[float, tuple[set[Incomplete], set[Incomplete]]]: ...
@@ -1,7 +1,9 @@
from _typeshed import Incomplete
from networkx.classes.graph import Graph, _Node
from networkx.utils.backends import _dispatchable
__all__ = ["ramsey_R2"]
@_dispatchable
def ramsey_R2(G: Graph[_Node]): ...
def ramsey_R2(G: Graph[_Node]) -> tuple[set[Incomplete], set[Incomplete]]: ...
@@ -11,6 +11,8 @@ __all__ = ["metric_closure", "steiner_tree"]
@deprecated(
"`metric_closure` is deprecated and will be removed in NetworkX 3.8. Use `networkx.all_pairs_shortest_path_length` instead."
)
def metric_closure(G: Graph[_Node], weight="weight"): ...
def metric_closure(G: Graph[_Node], weight="weight") -> Graph[Incomplete]: ...
@_dispatchable
def steiner_tree(G: Graph[_Node], terminal_nodes: Iterable[Incomplete], weight: str = "weight", method: str | None = None): ...
def steiner_tree(
G: Graph[_Node], terminal_nodes: Iterable[Incomplete], weight: str = "weight", method: str | None = None
) -> Graph[Incomplete]: ...
@@ -30,30 +30,32 @@ def traveling_salesman_problem(
cycle: bool = True,
method: Callable[..., Incomplete] | None = None,
**kwargs,
): ...
) -> list[Incomplete]: ...
@_dispatchable
def asadpour_atsp(
G: DiGraph[_Node], weight: str | None = "weight", seed: int | RandomState | None = None, source: str | None = None
): ...
) -> list[Incomplete]: ...
@_dispatchable
def held_karp_ascent(G: Graph[_Node], weight="weight"): ...
def held_karp_ascent(
G: Graph[_Node], weight: str = "weight"
) -> tuple[float, dict[Incomplete, Incomplete] | Graph[Incomplete]]: ...
@_dispatchable
def spanning_tree_distribution(G: Graph[_Node], z: Mapping[Incomplete, Incomplete]) -> dict[Incomplete, Incomplete]: ...
@_dispatchable
def greedy_tsp(G: Graph[_Node], weight: str | None = "weight", source=None): ...
def greedy_tsp(G: Graph[_Node], weight: str | None = "weight", source=None) -> list[Incomplete]: ...
@_dispatchable
def simulated_annealing_tsp(
G: Graph[_Node],
init_cycle,
init_cycle: Literal["greedy"] | Iterable[Incomplete],
weight: str | None = "weight",
source=None,
temp: int | None = 100,
move="1-1",
move: Callable[..., Incomplete] | Literal["1-1", "1-0"] = "1-1",
max_iterations: int | None = 10,
N_inner: int | None = 100,
alpha=0.01,
alpha: float = 0.01,
seed: int | RandomState | None = None,
): ...
) -> list[Incomplete]: ...
@_dispatchable
def threshold_accepting_tsp(
G: Graph[_Node],
@@ -61,9 +63,9 @@ def threshold_accepting_tsp(
weight: str | None = "weight",
source=None,
threshold: int | None = 1,
move="1-1",
move: Callable[..., Incomplete] | Literal["1-1", "1-0"] = "1-1",
max_iterations: int | None = 10,
N_inner: int | None = 100,
alpha=0.1,
alpha: float = 0.1,
seed: int | RandomState | None = None,
): ...
) -> list[Incomplete]: ...
@@ -1,6 +1,7 @@
from _typeshed import Incomplete
from collections.abc import Iterable, Mapping
import numpy as np
from networkx.classes.graph import Graph, _Node
from networkx.utils.backends import _dispatchable
@@ -17,7 +18,7 @@ def attribute_mixing_matrix(
nodes: Iterable[Incomplete] | None = None,
mapping: Mapping[Incomplete, Incomplete] | None = None,
normalized: bool = True,
): ...
) -> np.ndarray[Incomplete, Incomplete]: ...
@_dispatchable
def degree_mixing_dict(
G: Graph[_Node], x: str = "out", y: str = "in", weight: str | None = None, nodes=None, normalized: bool = False
@@ -31,6 +32,6 @@ def degree_mixing_matrix(
nodes: Iterable[Incomplete] | None = None,
normalized: bool = True,
mapping: Mapping[Incomplete, Incomplete] | None = None,
): ...
) -> np.ndarray[Incomplete, Incomplete]: ...
@_dispatchable
def mixing_dict(xy, normalized: bool = False) -> dict[Incomplete, Incomplete]: ...
def mixing_dict(xy: Iterable[tuple[Incomplete, Incomplete]], normalized: bool = False) -> dict[Incomplete, Incomplete]: ...
@@ -1,5 +1,5 @@
from _typeshed import Incomplete
from collections.abc import Iterable
from collections.abc import Collection, Iterable
from networkx.classes.graph import Graph, _Node
from networkx.utils.backends import _dispatchable
@@ -15,6 +15,6 @@ def is_bipartite_node_set(G: Graph[_Node], nodes: Iterable[Incomplete]) -> bool:
@_dispatchable
def sets(G: Graph[_Node], top_nodes: Iterable[Incomplete] | None = None) -> tuple[set[Incomplete], set[Incomplete]]: ...
@_dispatchable
def density(B: Graph[_Node], nodes) -> float: ...
def density(B: Graph[_Node], nodes: Collection[Incomplete]) -> float: ...
@_dispatchable
def degrees(B: Graph[_Node], nodes, weight: str | None = None) -> tuple[Incomplete, Incomplete]: ...
def degrees(B: Graph[_Node], nodes: Iterable[Incomplete], weight: str | None = None) -> tuple[Incomplete, Incomplete]: ...
@@ -1,4 +1,5 @@
from _typeshed import Incomplete
from collections.abc import Iterable
from networkx.classes.graph import Graph, _Node
from networkx.utils.backends import _dispatchable
@@ -6,8 +7,10 @@ from networkx.utils.backends import _dispatchable
__all__ = ["degree_centrality", "betweenness_centrality", "closeness_centrality"]
@_dispatchable
def degree_centrality(G: Graph[_Node], nodes) -> dict[Incomplete, Incomplete]: ...
def degree_centrality(G: Graph[_Node], nodes: Iterable[Incomplete]) -> dict[Incomplete, Incomplete]: ...
@_dispatchable
def betweenness_centrality(G: Graph[_Node], nodes) -> dict[Incomplete, Incomplete]: ...
def betweenness_centrality(G: Graph[_Node], nodes: Iterable[Incomplete]) -> dict[Incomplete, Incomplete]: ...
@_dispatchable
def closeness_centrality(G: Graph[_Node], nodes, normalized: bool | None = True) -> dict[Incomplete, Incomplete]: ...
def closeness_centrality(
G: Graph[_Node], nodes: Iterable[Incomplete], normalized: bool | None = True
) -> dict[Incomplete, Incomplete]: ...
@@ -1,4 +1,5 @@
from collections.abc import Generator
from _typeshed import Incomplete, StrPath, SupportsRead, SupportsWrite
from collections.abc import Collection, Generator, Iterable
from networkx.classes.graph import Graph, _Node
from networkx.utils.backends import _dispatchable
@@ -7,27 +8,32 @@ __all__ = ["generate_edgelist", "write_edgelist", "parse_edgelist", "read_edgeli
@_dispatchable
def write_edgelist(
G: Graph[_Node], path, comments: str = "#", delimiter: str = " ", data: bool = True, encoding: str = "utf-8"
G: Graph[_Node],
path: StrPath | SupportsWrite[bytes],
comments: str = "#",
delimiter: str = " ",
data: bool = True,
encoding: str = "utf-8",
) -> None: ...
@_dispatchable
def generate_edgelist(G: Graph[_Node], delimiter: str = " ", data: bool = True) -> Generator[str]: ...
@_dispatchable
def parse_edgelist(
lines,
lines: Iterable[str],
comments: str | None = "#",
delimiter: str | None = None,
create_using: Graph[_Node] | None = None,
nodetype=None,
data=True,
): ...
create_using: Graph[_Node] | type[Graph[_Node]] | None = None,
nodetype: type[Incomplete] | None = None,
data: bool | Collection[tuple[str, type[Incomplete]]] = True,
) -> Graph[Incomplete]: ...
@_dispatchable
def read_edgelist(
path,
path: StrPath | SupportsRead[bytes],
comments: str | None = "#",
delimiter: str | None = None,
create_using=None,
create_using: Graph[Incomplete] | type[Graph[Incomplete]] | None = None,
nodetype=None,
data=True,
data: bool | Collection[tuple[str, type[Incomplete]]] = True,
edgetype=None,
encoding: str | None = "utf-8",
): ...
) -> Graph[Incomplete]: ...
@@ -4,4 +4,4 @@ from networkx.utils.backends import _dispatchable
__all__ = ["maximal_extendability"]
@_dispatchable
def maximal_extendability(G: Graph[_Node]): ...
def maximal_extendability(G: Graph[_Node]) -> int: ...
@@ -17,27 +17,32 @@ __all__ = [
]
@_dispatchable
def complete_bipartite_graph(n1, n2, create_using: Graph[_Node] | None = None): ...
def complete_bipartite_graph(n1, n2, create_using: Graph[_Node] | type[Graph[_Node]] | None = None): ...
@_dispatchable
def configuration_model(
aseq: Iterable[Incomplete],
bseq: Iterable[Incomplete],
create_using: Graph[_Node] | None = None,
create_using: Graph[_Node] | type[Graph[_Node]] | None = None,
seed: int | RandomState | None = None,
): ...
@_dispatchable
def havel_hakimi_graph(aseq: Iterable[Incomplete], bseq: Iterable[Incomplete], create_using: Graph[_Node] | None = None): ...
def havel_hakimi_graph(
aseq: Iterable[Incomplete], bseq: Iterable[Incomplete], create_using: Graph[_Node] | type[Graph[_Node]] | None = None
): ...
@_dispatchable
def reverse_havel_hakimi_graph(
aseq: Iterable[Incomplete], bseq: Iterable[Incomplete], create_using: Graph[_Node] | None = None
aseq: Iterable[Incomplete], bseq: Iterable[Incomplete], create_using: Graph[_Node] | type[Graph[_Node]] | None = None
): ...
@_dispatchable
def alternating_havel_hakimi_graph(
aseq: Iterable[Incomplete], bseq: Iterable[Incomplete], create_using: Graph[_Node] | None = None
aseq: Iterable[Incomplete], bseq: Iterable[Incomplete], create_using: Graph[_Node] | type[Graph[_Node]] | None = None
): ...
@_dispatchable
def preferential_attachment_graph(
aseq: Iterable[Incomplete], p: float, create_using: Graph[_Node] | None = None, seed: int | RandomState | None = None
aseq: Iterable[Incomplete],
p: float,
create_using: Graph[_Node] | type[Graph[_Node]] | None = None,
seed: int | RandomState | None = None,
): ...
@_dispatchable
def random_graph(n: int, m: int, p: float, seed: int | RandomState | None = None, directed: bool | None = False): ...
@@ -13,7 +13,7 @@ def eppstein_matching(G: Graph[_Node], top_nodes: Iterable[Incomplete] | None =
@_dispatchable
def to_vertex_cover(
G: Graph[_Node], matching: Mapping[Incomplete, Incomplete], top_nodes: Iterable[Incomplete] | None = None
): ...
) -> set[Incomplete]: ...
maximum_matching = hopcroft_karp_matching
@@ -1,6 +1,7 @@
from _typeshed import Incomplete
from collections.abc import Iterable
import numpy as np
from networkx.classes.graph import Graph, _Node
from networkx.utils.backends import _dispatchable
@@ -11,16 +12,16 @@ def biadjacency_matrix(
G: Graph[_Node],
row_order: Iterable[_Node],
column_order: Iterable[Incomplete] | None = None,
dtype=None,
dtype: np.dtype[Incomplete] | None = None,
weight: str | None = "weight",
format="csr",
format: str = "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,
create_using: Graph[_Node] | type[Graph[_Node]] | None = None,
edge_attribute: str = "weight",
*,
row_order: Iterable[Incomplete] | None = None,
column_order: Iterable[Incomplete] | None = None,
): ...
) -> Graph[Incomplete]: ...
@@ -13,14 +13,14 @@ __all__ = [
]
@_dispatchable
def projected_graph(B: Graph[_Node], nodes: Iterable[Incomplete], multigraph: bool = False): ...
def projected_graph(B: Graph[_Node], nodes: Iterable[Incomplete], multigraph: bool = False) -> Graph[Incomplete]: ...
@_dispatchable
def weighted_projected_graph(B: Graph[_Node], nodes: Iterable[Incomplete], ratio: bool = False): ...
def weighted_projected_graph(B: Graph[_Node], nodes: Iterable[Incomplete], ratio: bool = False) -> Graph[Incomplete]: ...
@_dispatchable
def collaboration_weighted_projected_graph(B: Graph[_Node], nodes: Iterable[Incomplete]): ...
def collaboration_weighted_projected_graph(B: Graph[_Node], nodes: Iterable[Incomplete]) -> Graph[Incomplete]: ...
@_dispatchable
def overlap_weighted_projected_graph(B: Graph[_Node], nodes: Iterable[Incomplete], jaccard: bool = True): ...
def overlap_weighted_projected_graph(B: Graph[_Node], nodes: Iterable[Incomplete], jaccard: bool = True) -> Graph[Incomplete]: ...
@_dispatchable
def generic_weighted_projected_graph(
B: Graph[_Node], nodes: Iterable[Incomplete], weight_function: Callable[..., Incomplete] | None = None
): ...
) -> Graph[Incomplete]: ...
@@ -1,4 +1,5 @@
from _typeshed import Incomplete
from collections.abc import Iterable
from networkx.classes.graph import Graph, _Node
from networkx.utils.backends import _dispatchable
@@ -6,4 +7,6 @@ from networkx.utils.backends import _dispatchable
__all__ = ["spectral_bipartivity"]
@_dispatchable
def spectral_bipartivity(G: Graph[_Node], nodes=None, weight: str = "weight") -> float | dict[Incomplete, Incomplete]: ...
def spectral_bipartivity(
G: Graph[_Node], nodes: Iterable[Incomplete] | None = None, weight: str = "weight"
) -> float | dict[Incomplete, Incomplete]: ...
@@ -1,5 +1,5 @@
from _typeshed import Incomplete
from collections.abc import Iterable
from collections.abc import Collection, Iterable
from networkx.classes.graph import Graph, _Node
from networkx.utils.backends import _dispatchable
@@ -15,8 +15,12 @@ __all__ = [
@_dispatchable
def group_betweenness_centrality(
G: Graph[_Node], C, normalized: bool | None = True, weight: str | None = None, endpoints: bool | None = False
): ...
G: Graph[_Node],
C: Collection[Incomplete],
normalized: bool | None = True,
weight: str | None = None,
endpoints: bool | None = False,
) -> list[float] | float: ...
@_dispatchable
def prominent_group(
G: Graph[_Node],
@@ -1,3 +1,4 @@
from _typeshed import Incomplete
from collections.abc import Collection
from networkx.classes.graph import Graph, _Node
@@ -13,4 +14,4 @@ def laplacian_centrality(
weight: str | None = "weight",
walk_type: str | None = None,
alpha: float = 0.95,
): ...
) -> dict[Incomplete, Incomplete]: ...
@@ -13,4 +13,4 @@ def newman_betweenness_centrality(
load_centrality = newman_betweenness_centrality
@_dispatchable
def edge_load_centrality(G: Graph[_Node], cutoff: bool | None = False): ...
def edge_load_centrality(G: Graph[_Node], cutoff: bool | None = False) -> dict[tuple[Incomplete, Incomplete], int]: ...
@@ -24,13 +24,13 @@ def find_cliques(G: Graph[_Node], nodes: Iterable[Incomplete] | None = None) ->
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: Graph[_Node, _NodeData, _EdgeData] | None = None
G: Graph[_Node], create_using: Graph[_Node, _NodeData, _EdgeData] | type[Graph[_Node, _NodeData, _EdgeData]] | None = None
) -> Graph[_Node, _NodeData, _EdgeData]: ...
@_dispatchable
def make_clique_bipartite(
G: Graph[_Node, _NodeData, _EdgeData],
fpos: bool | None = None,
create_using: Graph[_Node, _NodeData, _EdgeData] | None = None,
create_using: Graph[_Node, _NodeData, _EdgeData] | type[Graph[_Node, _NodeData, _EdgeData]] | None = None,
name=None,
) -> Graph[_Node]: ...
@@ -41,9 +41,11 @@ def node_clique_number(
@overload
def node_clique_number(G: Graph[_Node], nodes=None, cliques: Iterable[Incomplete] | None = None, separate_nodes=False) -> int: ...
def number_of_cliques(G: Graph[_Node], nodes=None, cliques=None) -> int | dict[Incomplete, Incomplete]: ...
def number_of_cliques(
G: Graph[_Node], nodes: list[_Node] | _Node | None = None, cliques: Iterable[Incomplete] | None = None
) -> int | dict[Incomplete, Incomplete]: ...
@_dispatchable
def max_weight_clique(G: Graph[_Node], weight="weight") -> tuple[list[Incomplete], int]: ...
def max_weight_clique(G: Graph[_Node], weight: str | None = "weight") -> tuple[list[Incomplete], int]: ...
class MaxWeightClique:
G: Graph[Incomplete]
@@ -1,4 +1,5 @@
from _typeshed import Incomplete
from collections import Counter
from collections.abc import Generator, Iterable
from networkx.classes.graph import Graph, _NBunch, _Node
@@ -29,4 +30,6 @@ def transitivity(G: Graph[_Node]) -> float: ...
@_dispatchable
def square_clustering(G: Graph[_Node], nodes: Iterable[_Node] | None = None) -> float | int | dict[Incomplete, float | int]: ...
@_dispatchable
def generalized_degree(G: Graph[_Node], nodes: Iterable[_Node] | None = None): ...
def generalized_degree(
G: Graph[_Node], nodes: Iterable[_Node] | None = None
) -> Counter[Incomplete] | dict[Incomplete, Counter[Incomplete]]: ...
@@ -20,4 +20,4 @@ def move_witnesses(src_color, dst_color, N, H, F, C, T_cal, L): ...
def pad_graph(G: Graph[_Node], num_colors): ...
def procedure_P(V_minus, V_plus, N, H, F, C, L, excluded_colors=None): ...
@_dispatchable
def equitable_color(G: Graph[_Node], num_colors): ...
def equitable_color(G: Graph[_Node], num_colors: int) -> dict[Incomplete, Incomplete]: ...
@@ -1,6 +1,6 @@
from _typeshed import Incomplete, Unused
from collections.abc import Callable, Generator
from typing import Final
from typing import Final, Literal
from networkx.classes.graph import Graph, _Node
from networkx.utils.backends import _dispatchable
@@ -37,4 +37,21 @@ def strategy_saturation_largest_first(G: Graph[_Node], colors) -> Generator[Inco
STRATEGIES: Final[dict[str, Callable[..., Incomplete]]]
@_dispatchable
def greedy_color(G: Graph[_Node], strategy="largest_first", interchange: bool = False): ...
def greedy_color(
G: Graph[_Node],
strategy: (
Callable[..., Incomplete]
| Literal[
"largest_first",
"random_sequential",
"smallest_last",
"independent_set",
"connected_sequential_bfs",
"connected_sequential_dfs",
"connected_sequential",
"saturation_largest_first",
"DSATUR",
]
) = "largest_first",
interchange: bool = False,
) -> dict[Incomplete, Incomplete]: ...
@@ -1,5 +1,5 @@
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
@@ -7,4 +7,4 @@ from networkx.utils.backends import _dispatchable
__all__ = ["k_clique_communities"]
@_dispatchable
def k_clique_communities(G: Graph[_Node], k: int, cliques=None) -> Generator[Incomplete]: ...
def k_clique_communities(G: Graph[_Node], k: int, cliques: Iterable[Incomplete] | None = None) -> Generator[Incomplete]: ...
@@ -1,3 +1,5 @@
from _typeshed import Incomplete
from networkx.classes.graph import Graph, _Node
from networkx.utils.backends import _dispatchable
from numpy.random import RandomState
@@ -11,7 +13,7 @@ def leiden_communities(
resolution: float = 1,
max_level: int | None = None,
seed: int | RandomState | None = None,
): ...
) -> list[Incomplete]: ...
@_dispatchable
def leiden_partitions(
G: Graph[_Node], weight: str | None = "weight", resolution: float = 1, seed: int | RandomState | None = None
@@ -1,3 +1,4 @@
from _typeshed import Incomplete
from typing import Final
from networkx.classes.graph import Graph, _Node
@@ -13,4 +14,4 @@ PKEY: Final = "partitions"
CLUSTER_EVAL_CACHE_SIZE: Final = 2048
@_dispatchable
def lukes_partitioning(G: Graph[_Node], max_size: int, node_weight=None, edge_weight=None): ...
def lukes_partitioning(G: Graph[_Node], max_size: int, node_weight=None, edge_weight=None) -> list[Incomplete]: ...
@@ -10,4 +10,6 @@ def greedy_modularity_communities(
G: Graph[_Node], weight: str | None = None, resolution: float | None = 1, cutoff: int | None = 1, best_n: int | None = None
) -> list[set[Incomplete]] | list[frozenset[Incomplete]]: ...
@_dispatchable
def naive_greedy_modularity_communities(G: Graph[_Node], resolution: float = 1, weight: str | None = None): ...
def naive_greedy_modularity_communities(
G: Graph[_Node], resolution: float = 1, weight: str | None = None
) -> list[Incomplete]: ...
@@ -1,3 +1,6 @@
from _typeshed import Incomplete
from collections.abc import Iterable
from networkx.classes.graph import Graph, _Node
from networkx.exception import NetworkXError
from networkx.utils.backends import _dispatchable
@@ -11,12 +14,14 @@ class NotAPartition(NetworkXError):
require_partition: argmap
@_dispatchable
def intra_community_edges(G: Graph[_Node], partition): ...
def intra_community_edges(G: Graph[_Node], partition: Iterable[Incomplete]): ...
@_dispatchable
def inter_community_edges(G: Graph[_Node], partition): ...
def inter_community_edges(G: Graph[_Node], partition: Iterable[Incomplete]): ...
@_dispatchable
def inter_community_non_edges(G: Graph[_Node], partition): ...
def inter_community_non_edges(G: Graph[_Node], partition: Iterable[Incomplete]): ...
@_dispatchable
def modularity(G: Graph[_Node], communities, weight: str | None = "weight", resolution: float = 1): ...
def modularity(
G: Graph[_Node], communities: Iterable[set[Incomplete]], weight: str | None = "weight", resolution: float = 1
) -> float: ...
@_dispatchable
def partition_quality(G: Graph[_Node], partition): ...
def partition_quality(G: Graph[_Node], partition: Iterable[Incomplete]) -> tuple[float, float]: ...
@@ -1,5 +1,5 @@
from _typeshed import Incomplete, SupportsGetItem
from collections.abc import Generator
from collections.abc import Collection, Generator, Iterable
from typing import NamedTuple
from networkx.classes.graph import Graph, _Node
@@ -20,11 +20,22 @@ def k_edge_augmentation(
partial: bool = False,
) -> Generator[tuple[_Node, _Node]]: ...
@_dispatchable
def partial_k_edge_augmentation(G: Graph[_Node], k, avail, weight: str | None = None): ...
def partial_k_edge_augmentation(
G: Graph[_Node], k: int, avail: dict[Incomplete, Incomplete] | Collection[tuple[Incomplete, ...]], weight: str | None = None
): ...
@_dispatchable
def one_edge_augmentation(G: Graph[_Node], avail=None, weight: str | None = None, partial: bool = False): ...
def one_edge_augmentation(
G: Graph[_Node],
avail: dict[Incomplete, Incomplete] | Collection[tuple[Incomplete, ...]] | None = None,
weight: str | None = None,
partial: bool = False,
): ...
@_dispatchable
def bridge_augmentation(G: Graph[_Node], avail=None, weight: str | None = None): ...
def bridge_augmentation(
G: Graph[_Node],
avail: dict[Incomplete, Incomplete] | Collection[tuple[Incomplete, ...]] | None = None,
weight: str | None = None,
): ...
class MetaEdge(NamedTuple):
meta_uv: Incomplete
@@ -34,14 +45,27 @@ class MetaEdge(NamedTuple):
@_dispatchable
def unconstrained_one_edge_augmentation(G: Graph[_Node]): ...
@_dispatchable
def weighted_one_edge_augmentation(G: Graph[_Node], avail, weight: str | None = None, partial: bool = False): ...
def weighted_one_edge_augmentation(
G: Graph[_Node],
avail: dict[Incomplete, Incomplete] | Collection[tuple[Incomplete, ...]],
weight: str | None = None,
partial: bool = False,
): ...
@_dispatchable
def unconstrained_bridge_augmentation(G: Graph[_Node]): ...
@_dispatchable
def weighted_bridge_augmentation(G: Graph[_Node], avail, weight: str | None = None): ...
def weighted_bridge_augmentation(
G: Graph[_Node], avail: dict[Incomplete, Incomplete] | Collection[tuple[Incomplete, ...]], weight: str | None = None
): ...
@_dispatchable
def collapse(G: Graph[_Node], grouped_nodes): ...
def collapse(G: Graph[_Node], grouped_nodes: Iterable[Incomplete]) -> Graph[Incomplete]: ...
@_dispatchable
def complement_edges(G: Graph[_Node]): ...
@_dispatchable
def greedy_k_edge_augmentation(G: Graph[_Node], k, avail=None, weight: str | None = None, seed=None): ...
def greedy_k_edge_augmentation(
G: Graph[_Node],
k: int,
avail: dict[Incomplete, Incomplete] | Collection[tuple[Incomplete, ...]] | None = None,
weight: str | None = None,
seed=None,
): ...
@@ -7,9 +7,9 @@ from networkx.utils.backends import _dispatchable
__all__ = ["k_edge_components", "k_edge_subgraphs", "bridge_components", "EdgeComponentAuxGraph"]
@_dispatchable
def k_edge_components(G: Graph[_Node], k: int): ...
def k_edge_components(G: Graph[_Node], k: int) -> Generator[set[Incomplete]]: ...
@_dispatchable
def k_edge_subgraphs(G: Graph[_Node], k: int): ...
def k_edge_subgraphs(G: Graph[_Node], k: int) -> Generator[Incomplete, Incomplete, Incomplete]: ...
@_dispatchable
def bridge_components(G: Graph[_Node]) -> Generator[Incomplete, Incomplete]: ...
@@ -23,4 +23,4 @@ class EdgeComponentAuxGraph:
def k_edge_subgraphs(self, k: int) -> Generator[Incomplete, Incomplete]: ...
@_dispatchable
def general_k_edge_subgraphs(G: Graph[_Node], k): ...
def general_k_edge_subgraphs(G: Graph[_Node], k: int): ...
@@ -1,7 +1,11 @@
from _typeshed import Incomplete
from networkx.classes.graph import Graph, _Node
from networkx.utils.backends import _dispatchable
__all__ = ["stoer_wagner"]
@_dispatchable
def stoer_wagner(G: Graph[_Node], weight: str = "weight", heap: type = ...): ...
def stoer_wagner(
G: Graph[_Node], weight: str = "weight", heap: type = ...
) -> tuple[int | float, tuple[list[Incomplete], list[Incomplete]]]: ...
@@ -9,14 +9,20 @@ __all__ = ["core_number", "k_core", "k_shell", "k_crust", "k_corona", "k_truss",
@_dispatchable
def core_number(G: Graph[_Node]) -> dict[Incomplete, Incomplete]: ...
@_dispatchable
def k_core(G: Graph[_Node], k: int | None = None, core_number: Mapping[Incomplete, Incomplete] | None = None): ...
def k_core(
G: Graph[_Node], k: int | None = None, core_number: Mapping[Incomplete, Incomplete] | None = None
) -> Graph[Incomplete]: ...
@_dispatchable
def k_shell(G: Graph[_Node], k: int | None = None, core_number: Mapping[Incomplete, Incomplete] | None = None): ...
def k_shell(
G: Graph[_Node], k: int | None = None, core_number: Mapping[Incomplete, Incomplete] | None = None
) -> Graph[Incomplete]: ...
@_dispatchable
def k_crust(G: Graph[_Node], k: int | None = None, core_number: Mapping[Incomplete, Incomplete] | None = None): ...
def k_crust(
G: Graph[_Node], k: int | None = None, core_number: Mapping[Incomplete, Incomplete] | None = None
) -> Graph[Incomplete]: ...
@_dispatchable
def k_corona(G: Graph[_Node], k: int | None, core_number: Mapping[Incomplete, Incomplete] | None = None): ...
def k_corona(G: Graph[_Node], k: int | None, core_number: Mapping[Incomplete, Incomplete] | None = None) -> Graph[Incomplete]: ...
@_dispatchable
def k_truss(G: Graph[_Node], k: int): ...
def k_truss(G: Graph[_Node], k: int) -> Graph[Incomplete]: ...
@_dispatchable
def onion_layers(G: Graph[_Node]) -> dict[Incomplete, Incomplete]: ...
@@ -15,18 +15,22 @@ __all__ = [
]
@_dispatchable
def cut_size(G: Graph[_Node], S: Iterable[_Node], T: Iterable[_Node] | None = None, weight: str | None = None): ...
def cut_size(G: Graph[_Node], S: Iterable[_Node], T: Iterable[_Node] | None = None, weight: str | None = None) -> float: ...
@_dispatchable
def volume(G: Graph[_Node], S: Iterable[_Node], weight: str | None = None): ...
def volume(G: Graph[_Node], S: Iterable[_Node], weight: str | None = None) -> float: ...
@_dispatchable
def normalized_cut_size(G: Graph[_Node], S: Iterable[_Node], T: Iterable[_Node] | None = None, weight: str | None = None): ...
def normalized_cut_size(
G: Graph[_Node], S: Iterable[_Node], T: Iterable[_Node] | None = None, weight: str | None = None
) -> float: ...
@_dispatchable
def conductance(G: Graph[_Node], S: Iterable[_Node], T: Iterable[_Node] | None = None, weight: str | None = None): ...
def conductance(G: Graph[_Node], S: Iterable[_Node], T: Iterable[_Node] | None = None, weight: str | None = None) -> float: ...
@_dispatchable
def edge_expansion(G: Graph[_Node], S: Iterable[_Node], T: Iterable[_Node] | None = None, weight: str | None = None): ...
def edge_expansion(G: Graph[_Node], S: Iterable[_Node], T: Iterable[_Node] | None = None, weight: str | None = None) -> float: ...
@_dispatchable
def mixing_expansion(G: Graph[_Node], S: Iterable[_Node], T: Iterable[_Node] | None = None, weight: str | None = None): ...
def mixing_expansion(
G: Graph[_Node], S: Iterable[_Node], T: Iterable[_Node] | None = None, weight: str | None = None
) -> float: ...
@_dispatchable
def node_expansion(G: Graph[_Node], S: Iterable[_Node]): ...
def node_expansion(G: Graph[_Node], S: Iterable[_Node]) -> float: ...
@_dispatchable
def boundary_expansion(G: Graph[_Node], S: Iterable[_Node]): ...
def boundary_expansion(G: Graph[_Node], S: Iterable[_Node]) -> float: ...
@@ -9,7 +9,9 @@ __all__ = ["is_d_separator", "is_minimal_d_separator", "find_minimal_d_separator
@_dispatchable
def is_d_separator(G: DiGraph[_Node], x: _Node | set[_Node], y: _Node | set[_Node], z: _Node | set[_Node]) -> bool: ...
@_dispatchable
def find_minimal_d_separator(G: DiGraph[_Node], x, y, *, included=None, restricted=None) -> set[Incomplete] | None: ...
def find_minimal_d_separator(
G: DiGraph[_Node], x: set[Incomplete] | Incomplete, y: set[Incomplete] | Incomplete, *, included=None, restricted=None
) -> set[Incomplete] | None: ...
@_dispatchable
def is_minimal_d_separator(
G: DiGraph[_Node],
@@ -40,7 +40,9 @@ def all_topological_sorts(G: DiGraph[_Node]) -> Generator[list[_Node]]: ...
@_dispatchable
def is_aperiodic(G: DiGraph[_Node]) -> bool: ...
@_dispatchable
def transitive_closure(G: Graph[_Node, _NodeData, _EdgeData], reflexive=False) -> Graph[_Node, _NodeData, _EdgeData]: ...
def transitive_closure(
G: Graph[_Node, _NodeData, _EdgeData], reflexive: bool | None = False
) -> Graph[_Node, _NodeData, _EdgeData]: ...
@_dispatchable
def transitive_closure_dag(
G: DiGraph[_Node, _NodeData, _EdgeData], topo_order: Iterable[Incomplete] | None = None
@@ -1,9 +1,11 @@
from _typeshed import Incomplete
from networkx.classes.graph import Graph, _Node
from networkx.utils.backends import _dispatchable
__all__ = ["immediate_dominators", "dominance_frontiers"]
@_dispatchable
def immediate_dominators(G: Graph[_Node], start: _Node): ...
def immediate_dominators(G: Graph[_Node], start: _Node) -> dict[Incomplete, Incomplete]: ...
@_dispatchable
def dominance_frontiers(G: Graph[_Node], start: _Node): ...
def dominance_frontiers(G: Graph[_Node], start: _Node) -> dict[Incomplete, Incomplete]: ...
@@ -2,6 +2,7 @@ from _typeshed import Incomplete
from collections.abc import Generator
from networkx.classes.graph import Graph, _Node
from networkx.classes.multigraph import MultiGraph
from networkx.utils.backends import _dispatchable
__all__ = ["is_eulerian", "eulerian_circuit", "eulerize", "is_semieulerian", "has_eulerian_path", "eulerian_path"]
@@ -17,4 +18,4 @@ def has_eulerian_path(G: Graph[_Node], source: _Node | None = None) -> bool: ...
@_dispatchable
def eulerian_path(G: Graph[_Node], source=None, keys: bool = False) -> Generator[Incomplete, Incomplete]: ...
@_dispatchable
def eulerize(G: Graph[_Node]): ...
def eulerize(G: Graph[_Node]) -> MultiGraph[Incomplete]: ...
@@ -1,3 +1,6 @@
from _typeshed import Incomplete
from networkx.classes.digraph import DiGraph
from networkx.classes.graph import Graph, _Node
from networkx.utils.backends import _dispatchable
@@ -12,4 +15,4 @@ def boykov_kolmogorov(
residual: Graph[_Node] | None = None,
value_only: bool = False,
cutoff: float | None = None,
): ...
) -> DiGraph[Incomplete]: ...
@@ -1,3 +1,5 @@
from _typeshed import Incomplete
from networkx.classes.graph import Graph, _Node
from networkx.utils.backends import _dispatchable
@@ -6,4 +8,4 @@ __all__ = ["capacity_scaling"]
@_dispatchable
def capacity_scaling(
G: Graph[_Node], demand: str = "demand", capacity: str = "capacity", weight: str = "weight", heap: type = ...
): ...
) -> tuple[int, dict[Incomplete, Incomplete]]: ...
@@ -1,3 +1,6 @@
from _typeshed import Incomplete
from networkx.classes.digraph import DiGraph
from networkx.classes.graph import Graph, _Node
from networkx.utils.backends import _dispatchable
@@ -12,4 +15,4 @@ def dinitz(
residual: Graph[_Node] | None = None,
value_only: bool = False,
cutoff: float | None = None,
): ...
) -> DiGraph[Incomplete]: ...
@@ -1,3 +1,6 @@
from _typeshed import Incomplete
from networkx.classes.digraph import DiGraph
from networkx.classes.graph import Graph, _Node
from networkx.utils.backends import _dispatchable
@@ -12,4 +15,4 @@ def edmonds_karp(
residual: Graph[_Node] | None = None,
value_only: bool = False,
cutoff: float | None = None,
): ...
) -> DiGraph[Incomplete]: ...
@@ -10,4 +10,6 @@ __all__ = ["gomory_hu_tree"]
default_flow_func = edmonds_karp
@_dispatchable
def gomory_hu_tree(G: Graph[_Node], capacity: str = "capacity", flow_func: Callable[..., Incomplete] | None = None): ...
def gomory_hu_tree(
G: Graph[_Node], capacity: str = "capacity", flow_func: Callable[..., Incomplete] | None = None
) -> Graph[Incomplete]: ...
@@ -17,7 +17,7 @@ def maximum_flow(
capacity: str = "capacity",
flow_func: Callable[..., Incomplete] | None = None,
**kwargs,
): ...
) -> tuple[int | float, dict[Incomplete, Incomplete]]: ...
@_dispatchable
def maximum_flow_value(
flowG: Graph[_Node],
@@ -26,7 +26,7 @@ def maximum_flow_value(
capacity: str = "capacity",
flow_func: Callable[..., Incomplete] | None = None,
**kwargs,
): ...
) -> int | float: ...
@_dispatchable
def minimum_cut(
flowG: Graph[_Node],
@@ -35,7 +35,7 @@ def minimum_cut(
capacity: str = "capacity",
flow_func: Callable[..., Incomplete] | None = None,
**kwargs,
): ...
) -> tuple[int | float, tuple[set[Incomplete], set[Incomplete]]]: ...
@_dispatchable
def minimum_cut_value(
flowG: Graph[_Node],
@@ -44,4 +44,4 @@ def minimum_cut_value(
capacity: str = "capacity",
flow_func: Callable[..., Incomplete] | None = None,
**kwargs,
): ...
) -> int | float: ...
@@ -1,3 +1,6 @@
from _typeshed import Incomplete
from networkx.classes.digraph import DiGraph
from networkx.classes.graph import Graph, _Node
from networkx.utils.backends import _dispatchable
@@ -12,4 +15,4 @@ def preflow_push(
residual: Graph[_Node] | None = None,
global_relabel_freq: float = 1,
value_only: bool = False,
): ...
) -> DiGraph[Incomplete]: ...
@@ -1,3 +1,6 @@
from _typeshed import Incomplete
from networkx.classes.digraph import DiGraph
from networkx.classes.graph import Graph, _Node
from networkx.utils.backends import _dispatchable
@@ -13,4 +16,4 @@ def shortest_augmenting_path(
value_only: bool = False,
two_phase: bool = False,
cutoff: float | None = None,
): ...
) -> DiGraph[Incomplete]: ...
@@ -1,9 +1,13 @@
from _typeshed import Incomplete
from networkx.classes.graph import Graph, _Node
from networkx.utils.backends import _dispatchable
__all__ = ["kl_connected_subgraph", "is_kl_connected"]
@_dispatchable
def kl_connected_subgraph(G: Graph[_Node], k: int, l: int, 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
) -> Graph[Incomplete]: ...
@_dispatchable
def is_kl_connected(G: Graph[_Node], k: int, l: int, low_memory: bool = False) -> bool: ...
@@ -1,3 +1,6 @@
from _typeshed import Incomplete
from collections.abc import Iterator
from networkx.classes.graph import Graph, _Node
from networkx.utils.backends import _dispatchable
@@ -6,6 +9,6 @@ __all__ = ["is_isolate", "isolates", "number_of_isolates"]
@_dispatchable
def is_isolate(G: Graph[_Node], n: _Node) -> bool: ...
@_dispatchable
def isolates(G: Graph[_Node]): ...
def isolates(G: Graph[_Node]) -> Iterator[Incomplete]: ...
@_dispatchable
def number_of_isolates(G: Graph[_Node]) -> int: ...
@@ -1,4 +1,5 @@
from _typeshed import Incomplete
from collections.abc import Callable, Iterable, Sequence
from types import FunctionType
from networkx.utils.backends import _dispatchable
@@ -16,25 +17,41 @@ __all__ = [
]
def copyfunc(f, name=None) -> FunctionType: ...
def allclose(x, y, rtol: float = 1.0000000000000001e-05, atol=1e-08) -> bool: ...
def allclose(x, y, rtol: float = 1.0000000000000001e-05, atol: float = 1e-08) -> bool: ...
@_dispatchable
def categorical_node_match(attr, default): ...
def categorical_node_match(
attr: str | Iterable[Incomplete], default: Incomplete | Iterable[Incomplete]
) -> Callable[..., Incomplete]: ...
categorical_edge_match: Incomplete
@_dispatchable
def categorical_multiedge_match(attr, default): ...
def categorical_multiedge_match(
attr: str | Iterable[Incomplete], default: Incomplete | Iterable[Incomplete]
) -> Callable[..., Incomplete]: ...
@_dispatchable
def numerical_node_match(attr, default, rtol: float = 1e-05, atol: float = 1e-08): ...
def numerical_node_match(
attr: str | Iterable[Incomplete], default: Incomplete | Iterable[Incomplete], rtol: float = 1e-05, atol: float = 1e-08
) -> Callable[..., Incomplete]: ...
numerical_edge_match: Incomplete
@_dispatchable
def numerical_multiedge_match(attr, default, rtol: float = 1e-05, atol: float = 1e-08): ...
def numerical_multiedge_match(
attr: str | Iterable[Incomplete], default: Incomplete | Iterable[Incomplete], rtol: float = 1e-05, atol: float = 1e-08
) -> Callable[..., Incomplete]: ...
@_dispatchable
def generic_node_match(attr, default, op): ...
def generic_node_match(
attr: str | Iterable[Incomplete],
default: Incomplete | Iterable[Incomplete],
op: Callable[..., Incomplete] | Sequence[Incomplete],
) -> Callable[..., Incomplete]: ...
generic_edge_match: Incomplete
@_dispatchable
def generic_multiedge_match(attr, default, op): ...
def generic_multiedge_match(
attr: str | Iterable[Incomplete],
default: Incomplete | Iterable[Incomplete],
op: Callable[..., Incomplete] | Sequence[Incomplete],
) -> Callable[..., Incomplete]: ...
@@ -8,6 +8,8 @@ __all__ = ["rooted_tree_isomorphism", "tree_isomorphism"]
@_dispatchable
def root_trees(t1, root1, t2, root2): ...
@_dispatchable
def rooted_tree_isomorphism(t1, root1, t2, root2) -> list[tuple[Incomplete, Incomplete]]: ...
def rooted_tree_isomorphism(
t1: Graph[Incomplete], root1, t2: Graph[Incomplete], root2
) -> list[tuple[Incomplete, Incomplete]]: ...
@_dispatchable
def tree_isomorphism(t1: Graph[_Node], t2: Graph[_Node]) -> list[tuple[Incomplete, Incomplete]]: ...
@@ -29,11 +29,13 @@ class _StateParameters(NamedTuple):
T2_tilde_in: Incomplete
@_dispatchable
def vf2pp_isomorphism(G1: Graph[_Node], G2: Graph[_Node], node_label: str | None = None, default_label: float | None = None): ...
def vf2pp_isomorphism(
G1: Graph[_Node], G2: Graph[_Node], node_label: str | None = None, default_label: float | None = None
) -> dict[Incomplete, Incomplete] | None: ...
@_dispatchable
def vf2pp_is_isomorphic(
G1: Graph[_Node], G2: Graph[_Node], node_label: str | None = None, default_label: float | None = None
): ...
) -> bool: ...
@_dispatchable
def vf2pp_all_isomorphisms(
G1: Graph[_Node], G2: Graph[_Node], node_label: str | None = None, default_label: float | None = None
@@ -1,3 +1,6 @@
from _typeshed import Incomplete
from collections.abc import Iterable, Iterator
from networkx.classes.graph import Graph, _Node
from networkx.utils.backends import _dispatchable
@@ -13,18 +16,26 @@ __all__ = [
]
@_dispatchable
def resource_allocation_index(G: Graph[_Node], ebunch=None): ...
def resource_allocation_index(G: Graph[_Node], ebunch: Iterable[Incomplete] | None = None) -> Iterator[Incomplete]: ...
@_dispatchable
def jaccard_coefficient(G: Graph[_Node], ebunch=None): ...
def jaccard_coefficient(G: Graph[_Node], ebunch: Iterable[Incomplete] | None = None) -> Iterator[Incomplete]: ...
@_dispatchable
def adamic_adar_index(G: Graph[_Node], ebunch=None): ...
def adamic_adar_index(G: Graph[_Node], ebunch: Iterable[Incomplete] | None = None) -> Iterator[Incomplete]: ...
@_dispatchable
def common_neighbor_centrality(G: Graph[_Node], ebunch=None, alpha=0.8): ...
def common_neighbor_centrality(
G: Graph[_Node], ebunch: Iterable[Incomplete] | None = None, alpha=0.8
) -> Iterator[Incomplete]: ...
@_dispatchable
def preferential_attachment(G: Graph[_Node], ebunch=None): ...
def preferential_attachment(G: Graph[_Node], ebunch: Iterable[Incomplete] | None = None) -> Iterator[Incomplete]: ...
@_dispatchable
def cn_soundarajan_hopcroft(G: Graph[_Node], ebunch=None, community: str | None = "community"): ...
def cn_soundarajan_hopcroft(
G: Graph[_Node], ebunch: Iterable[Incomplete] | None = None, community: str | None = "community"
) -> Iterator[Incomplete]: ...
@_dispatchable
def ra_index_soundarajan_hopcroft(G: Graph[_Node], ebunch=None, community: str | None = "community"): ...
def ra_index_soundarajan_hopcroft(
G: Graph[_Node], ebunch: Iterable[Incomplete] | None = None, community: str | None = "community"
) -> Iterator[Incomplete]: ...
@_dispatchable
def within_inter_cluster(G: Graph[_Node], ebunch=None, delta: float | None = 0.001, community: str | None = "community"): ...
def within_inter_cluster(
G: Graph[_Node], ebunch: Iterable[Incomplete] | None = None, delta: float | None = 0.001, community: str | None = "community"
) -> Iterator[Incomplete]: ...
@@ -1,5 +1,5 @@
from _typeshed import Incomplete
from collections.abc import Generator
from collections.abc import Generator, Iterable, Iterator
from networkx.classes.digraph import DiGraph
from networkx.classes.graph import _Node
@@ -8,8 +8,10 @@ from networkx.utils.backends import _dispatchable
__all__ = ["all_pairs_lowest_common_ancestor", "tree_all_pairs_lowest_common_ancestor", "lowest_common_ancestor"]
@_dispatchable
def all_pairs_lowest_common_ancestor(G: DiGraph[_Node], pairs=None): ...
def all_pairs_lowest_common_ancestor(G: DiGraph[_Node], pairs: Iterable[Incomplete] | None = None): ...
@_dispatchable
def lowest_common_ancestor(G: DiGraph[_Node], node1, node2, default=None): ...
@_dispatchable
def tree_all_pairs_lowest_common_ancestor(G: DiGraph[_Node], root: _Node | None = None, pairs=None) -> Generator[Incomplete]: ...
def tree_all_pairs_lowest_common_ancestor(
G: DiGraph[_Node], root: _Node | None = None, pairs: Iterator[Incomplete] | None = None
) -> Generator[Incomplete]: ...
@@ -11,18 +11,18 @@ def equivalence_classes(iterable: Iterable[_Node], relation: Callable[[_Node, _N
@_dispatchable
def quotient_graph(
G: Graph[_Node],
partition,
edge_relation=None,
partition: Callable[..., Incomplete] | dict[Incomplete, Incomplete] | list[set[Incomplete]],
edge_relation: Callable[..., Incomplete] | None = None,
node_data: Callable[..., Incomplete] | None = None,
edge_data: Callable[..., Incomplete] | None = None,
weight: str | None = "weight",
relabel: bool = False,
create_using: Graph[_Node] | None = None,
): ...
create_using: Graph[_Node] | type[Graph[_Node]] | None = None,
) -> Graph[Incomplete]: ...
@_dispatchable
def contracted_nodes(
G: Graph[_Node], u, v, self_loops: bool = True, copy: bool = True, *, store_contraction_as: str | None = "contraction"
): ...
) -> Graph[Incomplete]: ...
identified_nodes = contracted_nodes
@@ -34,4 +34,4 @@ def contracted_edge(
copy: bool = True,
*,
store_contraction_as: str | None = "contraction",
): ...
) -> Graph[Incomplete]: ...
@@ -1,7 +1,9 @@
from _typeshed import Incomplete
from networkx.classes.graph import Graph, _Node
from networkx.utils.backends import _dispatchable
__all__ = ["moral_graph"]
@_dispatchable
def moral_graph(G: Graph[_Node]): ...
def moral_graph(G: Graph[_Node]) -> Graph[Incomplete]: ...
@@ -1,9 +1,13 @@
from _typeshed import Incomplete
from networkx.classes.graph import Graph, _Node
from networkx.utils.backends import _dispatchable
__all__ = ["harmonic_function", "local_and_global_consistency"]
@_dispatchable
def harmonic_function(G: Graph[_Node], max_iter: int = 30, label_name: str = "label"): ...
def harmonic_function(G: Graph[_Node], max_iter: int = 30, label_name: str = "label") -> list[Incomplete]: ...
@_dispatchable
def local_and_global_consistency(G: Graph[_Node], 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"
) -> list[Incomplete]: ...
@@ -1,15 +1,16 @@
from _typeshed import Incomplete
from collections.abc import Iterable
from networkx.classes.graph import Graph
from networkx.utils.backends import _dispatchable
__all__ = ["union_all", "compose_all", "disjoint_union_all", "intersection_all"]
@_dispatchable
def union_all(graphs: Iterable[Incomplete], rename: Iterable[Incomplete] | None = ()): ...
def union_all(graphs: Iterable[Incomplete], rename: Iterable[Incomplete] | None = ()) -> Graph[Incomplete]: ...
@_dispatchable
def disjoint_union_all(graphs: Iterable[Incomplete]): ...
def disjoint_union_all(graphs: Iterable[Incomplete]) -> Graph[Incomplete]: ...
@_dispatchable
def compose_all(graphs: Iterable[Incomplete]): ...
def compose_all(graphs: Iterable[Incomplete]) -> Graph[Incomplete]: ...
@_dispatchable
def intersection_all(graphs: Iterable[Incomplete]): ...
def intersection_all(graphs: Iterable[Incomplete]) -> Graph[Incomplete]: ...
@@ -9,13 +9,13 @@ from networkx.utils.backends import _dispatchable
__all__ = ["union", "compose", "disjoint_union", "intersection", "difference", "symmetric_difference", "full_join"]
@_dispatchable
def disjoint_union(G: Graph[_Node], H: Graph[_Node]): ...
def disjoint_union(G: Graph[_Node], H: Graph[_Node]) -> Graph[Incomplete]: ...
@_dispatchable
def intersection(G: Graph[_Node], H: Graph[_Node]): ...
def intersection(G: Graph[_Node], H: Graph[_Node]) -> Graph[Incomplete]: ...
@_dispatchable
def difference(G: Graph[_Node], H: Graph[_Node]): ...
def difference(G: Graph[_Node], H: Graph[_Node]) -> Graph[Incomplete]: ...
@_dispatchable
def symmetric_difference(G: Graph[_Node], H: Graph[_Node]): ...
def symmetric_difference(G: Graph[_Node], H: Graph[_Node]) -> Graph[Incomplete]: ...
_X_co = TypeVar("_X_co", bound=Hashable, covariant=True)
_Y_co = TypeVar("_Y_co", bound=Hashable, covariant=True)
@@ -23,6 +23,6 @@ _Y_co = TypeVar("_Y_co", bound=Hashable, covariant=True)
@_dispatchable
def compose(G: Graph[_X_co], H: Graph[_Y_co]) -> DiGraph[_X_co | _Y_co]: ...
@_dispatchable
def full_join(G: Graph[_Node], H, rename=(None, None)): ...
def full_join(G: Graph[_Node], H, rename: tuple[Incomplete, Incomplete] = (None, None)) -> Graph[Incomplete]: ...
@_dispatchable
def union(G: Graph[_X_co], H: Graph[_Y_co], rename: Iterable[Incomplete] | None = ()) -> DiGraph[_X_co | _Y_co]: ...
@@ -28,7 +28,7 @@ def lexicographic_product(G: Graph[_X], H: Graph[_Y]) -> Graph[tuple[_X, _Y]]: .
@_dispatchable
def strong_product(G: Graph[_X], H: Graph[_Y]) -> Graph[tuple[_X, _Y]]: ...
@_dispatchable
def power(G: Graph[_Node], k): ...
def power(G: Graph[_Node], k: int) -> Graph[Incomplete]: ...
@_dispatchable
def rooted_product(G: Graph[_X], H: Graph[_Y], root: _Y) -> Graph[tuple[_X, _Y]]: ...
@_dispatchable
@@ -1,3 +1,4 @@
from _typeshed import Incomplete
from collections.abc import Hashable
from typing import TypeVar
@@ -9,6 +10,6 @@ _G = TypeVar("_G", bound=Graph[Hashable])
__all__ = ["complement", "reverse"]
@_dispatchable
def complement(G: Graph[_Node]): ...
def complement(G: Graph[_Node]) -> Graph[Incomplete]: ...
@_dispatchable
def reverse(G: _G, copy: bool = True) -> _G: ...
@@ -1,16 +1,21 @@
from _typeshed import Incomplete
from collections.abc import Sequence
from networkx.algorithms.planarity import PlanarEmbedding
from networkx.utils.backends import _dispatchable
__all__ = ["combinatorial_embedding_to_pos"]
@_dispatchable
def combinatorial_embedding_to_pos(embedding, fully_triangulate: bool = False) -> dict[Incomplete, Incomplete]: ...
def combinatorial_embedding_to_pos(
embedding: PlanarEmbedding[Incomplete], fully_triangulate: bool = False
) -> dict[Incomplete, Incomplete]: ...
def set_position(parent, tree, remaining_nodes, delta_x, y_coordinate, pos): ...
def get_canonical_ordering(embedding, outer_face: Sequence[Incomplete]) -> list[Incomplete]: ...
def triangulate_face(embedding, v1, v2): ...
def triangulate_embedding(embedding, fully_triangulate: bool = True): ...
def get_canonical_ordering(embedding: PlanarEmbedding[Incomplete], outer_face: Sequence[Incomplete]) -> list[Incomplete]: ...
def triangulate_face(embedding: PlanarEmbedding[Incomplete], v1, v2): ...
def triangulate_embedding(
embedding: PlanarEmbedding[Incomplete], fully_triangulate: bool = True
) -> tuple[PlanarEmbedding[Incomplete], list[Incomplete]]: ...
def make_bi_connected(
embedding, starting_node, outgoing_node, edges_counted: set[tuple[Incomplete, Incomplete]]
embedding: PlanarEmbedding[Incomplete], starting_node, outgoing_node, edges_counted: set[tuple[Incomplete, Incomplete]]
) -> list[Incomplete]: ...
@@ -12,7 +12,7 @@ __all__ = ["check_planarity", "is_planar", "PlanarEmbedding"]
@_dispatchable
def is_planar(G: Graph[_Node]) -> bool: ...
@_dispatchable
def check_planarity(G: Graph[_Node], counterexample: bool = False): ...
def check_planarity(G: Graph[_Node], counterexample: bool = False) -> tuple[bool, Graph[Incomplete]]: ...
@_dispatchable
def get_counterexample(G: Graph[_Node, _NodeData, _EdgeData]) -> Graph[_Node, _NodeData, _EdgeData]: ...
@_dispatchable
@@ -1,3 +1,5 @@
from _typeshed import Incomplete
from networkx.classes.graph import Graph, _Node
from networkx.utils.backends import _dispatchable
@@ -8,4 +10,4 @@ def is_regular(G: Graph[_Node]) -> bool: ...
@_dispatchable
def is_k_regular(G: Graph[_Node], k) -> bool: ...
@_dispatchable
def k_factor(G: Graph[_Node], k, matching_weight: str | None = "weight"): ...
def k_factor(G: Graph[_Node], k: int, matching_weight: str | None = "weight") -> Graph[Incomplete]: ...
@@ -2,13 +2,16 @@ from _typeshed import Incomplete, SupportsGetItem
from collections import defaultdict
from collections.abc import Collection
import numpy as np
from networkx.classes.graph import Graph, _Node
from networkx.utils.backends import _dispatchable
__all__ = ["floyd_warshall", "floyd_warshall_predecessor_and_distance", "reconstruct_path", "floyd_warshall_numpy"]
@_dispatchable
def floyd_warshall_numpy(G: Graph[_Node], nodelist: Collection[_Node] | None = None, weight: str | None = "weight"): ...
def floyd_warshall_numpy(
G: Graph[_Node], nodelist: Collection[_Node] | None = None, weight: str | None = "weight"
) -> np.ndarray[Incomplete, Incomplete]: ...
@_dispatchable
def floyd_warshall_predecessor_and_distance(
G: Graph[_Node], weight: str | None = "weight"
@@ -18,7 +18,9 @@ __all__ = [
@_dispatchable
def single_source_shortest_path_length(G: Graph[_Node], source: _Node, cutoff: int | None = None) -> dict[Incomplete, int]: ...
@_dispatchable
def single_target_shortest_path_length(G: Graph[_Node], target: _Node, cutoff: int | None = None): ...
def single_target_shortest_path_length(
G: Graph[_Node], target: _Node, cutoff: int | None = None
) -> dict[Incomplete, Incomplete]: ...
@_dispatchable
def all_pairs_shortest_path_length(G: Graph[_Node], cutoff: int | None = None) -> Generator[Incomplete]: ...
@_dispatchable
@@ -38,4 +40,4 @@ def all_pairs_shortest_path(
@_dispatchable
def predecessor(
G: Graph[_Node], source: _Node, target: _Node | None = None, cutoff: int | None = None, return_seen: bool | None = None
): ...
) -> dict[_Node, list[_Node]] | list[_Node] | tuple[dict[_Node, list[_Node]], dict[_Node, int]] | tuple[list[_Node], int]: ...
@@ -28,7 +28,7 @@ def graph_edit_distance(
edge_subst_cost: Callable[..., Incomplete] | None = None,
edge_del_cost: Callable[..., Incomplete] | None = None,
edge_ins_cost: Callable[..., Incomplete] | None = None,
roots=None,
roots: tuple[Incomplete, Incomplete] | None = None,
upper_bound: float | None = None,
timeout: float | None = None,
): ...
@@ -45,7 +45,7 @@ def optimal_edit_paths(
edge_del_cost: Callable[..., Incomplete] | None = None,
edge_ins_cost: Callable[..., Incomplete] | None = None,
upper_bound: float | None = None,
): ...
) -> tuple[list[tuple[Incomplete, Incomplete]], float]: ...
@_dispatchable
def optimize_graph_edit_distance(
G1: Graph[_Node],
@@ -74,7 +74,7 @@ def optimize_edit_paths(
edge_ins_cost: Callable[..., Incomplete] | None = None,
upper_bound: float | None = None,
strictly_decreasing: bool = True,
roots=None,
roots: tuple[Incomplete, Incomplete] | None = None,
timeout: float | None = None,
) -> Generator[Incomplete, None, Incomplete]: ...
@_dispatchable
@@ -1,3 +1,6 @@
from _typeshed import Incomplete
import numpy as np
from networkx.classes.graph import Graph, _Node
from networkx.utils.backends import _dispatchable
from numpy.random import RandomState
@@ -5,11 +8,17 @@ from numpy.random import RandomState
__all__ = ["random_reference", "lattice_reference", "sigma", "omega"]
@_dispatchable
def random_reference(G: Graph[_Node], niter: int = 1, connectivity: bool = True, seed: int | RandomState | None = None): ...
def random_reference(
G: Graph[_Node], niter: int = 1, connectivity: bool = True, seed: int | RandomState | None = None
) -> Graph[Incomplete]: ...
@_dispatchable
def lattice_reference(
G: Graph[_Node], niter: int = 5, D=None, connectivity: bool = True, seed: int | RandomState | None = None
): ...
G: Graph[_Node],
niter: int = 5,
D: np.ndarray[Incomplete, Incomplete] | None = None,
connectivity: bool = True,
seed: int | RandomState | None = None,
) -> Graph[Incomplete]: ...
@_dispatchable
def sigma(G: Graph[_Node], niter: int = 100, nrand: int = 10, seed: int | RandomState | None = None) -> float: ...
@_dispatchable
@@ -1,3 +1,5 @@
from _typeshed import Incomplete
from networkx.classes.graph import Graph, _Node
from networkx.utils.backends import _dispatchable
from numpy.random import RandomState
@@ -5,4 +7,6 @@ from numpy.random import RandomState
__all__ = ["spanner"]
@_dispatchable
def spanner(G: Graph[_Node], stretch: float, weight: str | None = None, seed: int | RandomState | None = None): ...
def spanner(
G: Graph[_Node], stretch: float, weight: str | None = None, seed: int | RandomState | None = None
) -> Graph[Incomplete]: ...
@@ -7,13 +7,15 @@ from networkx.utils.backends import _dispatchable
__all__ = ["dedensify", "snap_aggregation"]
@_dispatchable
def dedensify(G: Graph[_Node], threshold: int, prefix=None, copy: bool | None = True): ...
def dedensify(
G: Graph[_Node], threshold: int, prefix: str | None = None, copy: bool | None = True
) -> tuple[Graph[Incomplete], set[Incomplete]]: ...
@_dispatchable
def snap_aggregation(
G: Graph[_Node],
node_attributes,
node_attributes: Iterable[Incomplete],
edge_attributes: Iterable[Incomplete] | None = (),
prefix: str = "Supernode-",
supernode_attribute: str = "group",
superedge_attribute: str = "types",
): ...
) -> Graph[Incomplete]: ...

Some files were not shown because too many files have changed in this diff Show More