Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
eb2b783
Merged networkx stubs from python-type-stubs
Avasam May 13, 2025
67402d1
Replace `: Incomplete | None = None` with `=None`
Avasam May 13, 2025
2037be3
Fix failing tests
Avasam May 13, 2025
16f2a66
Support `requires_python` in `runtests.py`
Avasam May 13, 2025
1dad75f
Support `requires_python` in `runtests.py`
Avasam May 13, 2025
1f6be6e
Merge branch 'main' of https://github.com/python/typeshed into networ…
Avasam May 13, 2025
d487295
Merge branch 'main' of https://github.com/python/typeshed into networ…
Avasam May 14, 2025
72cf2c9
Discard changes to stubs/networkx/networkx/drawing/nx_agraph.pyi
Avasam May 14, 2025
e17709f
Update stubs/networkx/networkx/classes/multidigraph.pyi
Avasam May 14, 2025
47f5f7c
Update stubs/networkx/networkx/classes/digraph.pyi
Avasam May 14, 2025
73dbdbf
Remove accidental extra symbols
Avasam May 16, 2025
8aa5a56
Merge branch 'main' of https://github.com/python/typeshed into networ…
Avasam May 16, 2025
a092752
Replace `Graph[Incomplete]` with `Graph[_Node]`
Avasam May 22, 2025
8ab7313
Merge branch 'main' of https://github.com/python/typeshed into networ…
Avasam May 22, 2025
071e34d
Merge branch 'main' of https://github.com/python/typeshed into networ…
Avasam May 26, 2025
f52e0ce
Merge branch 'main' of https://github.com/python/typeshed into networ…
Avasam Jul 25, 2025
6409a80
Pass tests
Avasam Jul 25, 2025
39f5442
Merge branch 'main' into networkx-merge-from-python-type-stubs
Avasam Aug 5, 2025
33f6249
Discard changes to stubs/networkx/networkx/classes/digraph.pyi
Avasam Aug 20, 2025
cba33cc
Discard changes to stubs/networkx/networkx/classes/graph.pyi
Avasam Aug 20, 2025
fc0104b
Discard changes to stubs/networkx/networkx/classes/multidigraph.pyi
Avasam Aug 20, 2025
764a6d2
Discard changes to stubs/networkx/networkx/classes/multigraph.pyi
Avasam Aug 20, 2025
2ba94b7
Update stubs/networkx/networkx/classes/reportviews.pyi
Avasam Aug 20, 2025
f43c212
Merge branch 'main' of https://github.com/python/typeshed into networ…
Avasam Aug 20, 2025
5bcdc2c
Update stubs/networkx/networkx/algorithms/approximation/traveling_sal…
Avasam Aug 20, 2025
53989c5
Merge branch 'main' of https://github.com/python/typeshed into networ…
Avasam Aug 20, 2025
7c89025
Merge branch 'main' into networkx-merge-from-python-type-stubs
Avasam Sep 26, 2025
26c884f
Merge branch 'main' of https://github.com/python/typeshed into networ…
Avasam Oct 3, 2025
c83ac31
Merge branch 'main' into networkx-merge-from-python-type-stubs
Avasam Nov 3, 2025
3729186
Merge branch 'main' of https://github.com/python/typeshed into networ…
Avasam Dec 20, 2025
213708e
Post-merge fixes
Avasam Dec 20, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion stubs/networkx/networkx/algorithms/approximation/maxcut.pyi
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -12,5 +13,8 @@ def randomized_partitioning(
): ...
@_dispatchable
def one_exchange(
G: Graph[_Node], initial_cut: set[Incomplete] | None = None, seed: int | RandomState | None = None, weight: str | None = None
G: Graph[_Node],
initial_cut: Iterable[Incomplete] | None = None,
seed: int | RandomState | None = None,
weight: str | None = None,
): ...
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ def degree_pearson_correlation_coefficient(
def attribute_assortativity_coefficient(G: Graph[_Node], attribute: str, nodes: Iterable[Incomplete] | None = None) -> float: ...
@_dispatchable
def numeric_assortativity_coefficient(G: Graph[_Node], attribute: str, nodes: Iterable[Incomplete] | None = None) -> float: ...
def attribute_ac(M) -> float: ...
16 changes: 11 additions & 5 deletions stubs/networkx/networkx/algorithms/bipartite/edgelist.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from collections.abc import Generator
from _typeshed import Incomplete
from collections.abc import Generator, Iterable

from networkx.classes.graph import Graph, _Node
from networkx.utils.backends import _dispatchable
Expand All @@ -7,18 +8,23 @@ __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,
comments: str = "#",
delimiter: str = " ",
data: bool | Iterable[Incomplete] = True,
encoding: str = "utf-8",
) -> None: ...
@_dispatchable
def generate_edgelist(G: Graph[_Node], delimiter: str = " ", data: bool = True) -> Generator[str]: ...
def generate_edgelist(G: Graph[_Node], delimiter: str = " ", data: bool | Iterable[Incomplete] = True) -> Generator[str]: ...
@_dispatchable
def parse_edgelist(
lines,
comments: str | None = "#",
delimiter: str | None = None,
create_using: Graph[_Node] | None = None,
nodetype=None,
data=True,
data: bool | Iterable[Incomplete] = True,
): ...
@_dispatchable
def read_edgelist(
Expand All @@ -27,7 +33,7 @@ def read_edgelist(
delimiter: str | None = None,
create_using=None,
nodetype=None,
data=True,
data: bool | Iterable[Incomplete] = True,
edgetype=None,
encoding: str | None = "utf-8",
): ...
14 changes: 7 additions & 7 deletions stubs/networkx/networkx/algorithms/bipartite/generators.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from _typeshed import Incomplete
from collections.abc import Iterable
from collections.abc import Collection

from networkx.classes.graph import Graph, _Node
from networkx.utils.backends import _dispatchable
Expand All @@ -20,24 +20,24 @@ __all__ = [
def complete_bipartite_graph(n1, n2, create_using: Graph[_Node] | None = None): ...
@_dispatchable
def configuration_model(
aseq: Iterable[Incomplete],
bseq: Iterable[Incomplete],
aseq: Collection[Incomplete],
bseq: Collection[Incomplete],
create_using: 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: Collection[Incomplete], bseq: Collection[Incomplete], create_using: Graph[_Node] | None = None): ...
@_dispatchable
def reverse_havel_hakimi_graph(
aseq: Iterable[Incomplete], bseq: Iterable[Incomplete], create_using: Graph[_Node] | None = None
aseq: Collection[Incomplete], bseq: Collection[Incomplete], create_using: Graph[_Node] | None = None
): ...
@_dispatchable
def alternating_havel_hakimi_graph(
aseq: Iterable[Incomplete], bseq: Iterable[Incomplete], create_using: Graph[_Node] | None = None
aseq: Collection[Incomplete], bseq: Collection[Incomplete], create_using: 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: Collection[Incomplete], p: float, create_using: 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): ...
Expand Down
6 changes: 3 additions & 3 deletions stubs/networkx/networkx/algorithms/bipartite/matrix.pyi
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -9,8 +9,8 @@ __all__ = ["biadjacency_matrix", "from_biadjacency_matrix"]
@_dispatchable
def biadjacency_matrix(
G: Graph[_Node],
row_order: Iterable[_Node],
column_order: Iterable[Incomplete] | None = None,
row_order: Collection[_Node],
column_order: Collection[Incomplete] | None = None,
dtype=None,
weight: str | None = "weight",
format="csr",
Expand Down
4 changes: 2 additions & 2 deletions stubs/networkx/networkx/algorithms/bipartite/projection.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from _typeshed import Incomplete
from collections.abc import Callable, Iterable
from collections.abc import Callable, Collection, Iterable

from networkx.classes.graph import Graph, _Node
from networkx.utils.backends import _dispatchable
Expand All @@ -15,7 +15,7 @@ __all__ = [
@_dispatchable
def projected_graph(B: Graph[_Node], nodes: Iterable[Incomplete], multigraph: bool = False): ...
@_dispatchable
def weighted_projected_graph(B: Graph[_Node], nodes: Iterable[Incomplete], ratio: bool = False): ...
def weighted_projected_graph(B: Graph[_Node], nodes: Collection[Incomplete], ratio: bool = False): ...
@_dispatchable
def collaboration_weighted_projected_graph(B: Graph[_Node], nodes: Iterable[Incomplete]): ...
@_dispatchable
Expand Down
22 changes: 11 additions & 11 deletions stubs/networkx/networkx/algorithms/boundary.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def edge_boundary(
G: Graph[_Node],
nbunch1: Iterable[Incomplete],
nbunch2: Iterable[Incomplete] | None = None,
data=False,
data: bool | Incomplete = False,
keys: bool = False,
default=None,
) -> Generator[tuple[_Node, _Node], None, None]: ...
Expand All @@ -22,7 +22,7 @@ def edge_boundary(
G: Graph[_Node],
nbunch1: Iterable[Incomplete],
nbunch2: Iterable[Incomplete] | None = None,
data=False,
data: bool | Incomplete = False,
keys: bool = False,
default=None,
) -> Generator[tuple[_Node, _Node, dict[str, Incomplete]], None, None]: ...
Expand All @@ -31,7 +31,7 @@ def edge_boundary(
G: Graph[_Node],
nbunch1: Iterable[Incomplete],
nbunch2: Iterable[Incomplete] | None = None,
data=False,
data: bool | Incomplete = False,
keys: bool = False,
default=None,
) -> Generator[tuple[_Node, _Node, dict[str, Incomplete]], None, None]: ...
Expand All @@ -40,7 +40,7 @@ def edge_boundary(
G: Graph[_Node],
nbunch1: Iterable[Incomplete],
nbunch2: Iterable[Incomplete] | None = None,
data=False,
data: bool | Incomplete = False,
keys: bool = False,
default: _U | None = None,
) -> Generator[tuple[_Node, _Node, dict[str, _U]], None, None]: ...
Expand All @@ -49,7 +49,7 @@ def edge_boundary(
G: Graph[_Node],
nbunch1: Iterable[Incomplete],
nbunch2: Iterable[Incomplete] | None = None,
data=False,
data: bool | Incomplete = False,
keys: bool = False,
default: _U | None = None,
) -> Generator[tuple[_Node, _Node, dict[str, _U]], None, None]: ...
Expand All @@ -58,7 +58,7 @@ def edge_boundary(
G: Graph[_Node],
nbunch1: Iterable[Incomplete],
nbunch2: Iterable[Incomplete] | None = None,
data=False,
data: bool | Incomplete = False,
keys: bool = False,
default=None,
) -> Generator[tuple[_Node, _Node, int], None, None]: ...
Expand All @@ -67,7 +67,7 @@ def edge_boundary(
G: Graph[_Node],
nbunch1: Iterable[Incomplete],
nbunch2: Iterable[Incomplete] | None = None,
data=False,
data: bool | Incomplete = False,
keys: bool = False,
default=None,
) -> Generator[tuple[_Node, _Node, int], None, None]: ...
Expand All @@ -76,7 +76,7 @@ def edge_boundary(
G: Graph[_Node],
nbunch1: Iterable[Incomplete],
nbunch2: Iterable[Incomplete] | None = None,
data=False,
data: bool | Incomplete = False,
keys: bool = False,
default=None,
) -> Generator[tuple[_Node, _Node, int, dict[str, Incomplete]], None, None]: ...
Expand All @@ -85,7 +85,7 @@ def edge_boundary(
G: Graph[_Node],
nbunch1: Iterable[Incomplete],
nbunch2: Iterable[Incomplete] | None = None,
data=False,
data: bool | Incomplete = False,
keys: bool = False,
default=None,
) -> Generator[tuple[_Node, _Node, int, dict[str, Incomplete]], None, None]: ...
Expand All @@ -94,7 +94,7 @@ def edge_boundary(
G: Graph[_Node],
nbunch1: Iterable[Incomplete],
nbunch2: Iterable[Incomplete] | None = None,
data=False,
data: bool | Incomplete = False,
keys: bool = False,
default: _U | None = None,
) -> Generator[tuple[_Node, _Node, int, dict[str, _U]], None, None]: ...
Expand All @@ -103,7 +103,7 @@ def edge_boundary(
G: Graph[_Node],
nbunch1: Iterable[Incomplete],
nbunch2: Iterable[Incomplete] | None = None,
data=False,
data: bool | Incomplete = False,
keys: bool = False,
default: _U | None = None,
) -> Generator[tuple[_Node, _Node, int, dict[str, _U]], None, None]: ...
Expand Down
8 changes: 5 additions & 3 deletions stubs/networkx/networkx/algorithms/clique.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@ def make_clique_bipartite(
G: Graph[_Node], fpos: bool | None = None, create_using: Graph[_Node] | None = None, name=None
) -> Graph[_Node]: ...
@overload
def node_clique_number(
G: Graph[_Node], nodes=None, cliques: Iterable[Incomplete] | None = None, separate_nodes=False
def node_clique_number( # type: ignore[overload-overlap]
G: Graph[_Node], nodes: Iterable[_Node] | None = None, cliques: Iterable[Incomplete] | None = None, separate_nodes=False
) -> dict[_Node, int]: ...
@overload
def node_clique_number(G: Graph[_Node], nodes=None, cliques: Iterable[Incomplete] | None = None, separate_nodes=False) -> int: ...
def node_clique_number(
G: Graph[_Node], nodes: _Node, cliques: Iterable[Incomplete] | None = None, separate_nodes=False
) -> int: ...
def number_of_cliques(G: Graph[_Node], nodes=None, cliques=None) -> int | dict[Incomplete, Incomplete]: ...
@_dispatchable
def max_weight_clique(G: Graph[_Node], weight="weight") -> tuple[list[Incomplete], int]: ...
Expand Down
4 changes: 2 additions & 2 deletions stubs/networkx/networkx/algorithms/flow/mincost.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ def min_cost_flow_cost(
@_dispatchable
def min_cost_flow(
G: Graph[_Node], demand: str = "demand", capacity: str = "capacity", weight: str = "weight"
) -> dict[Incomplete, dict[Incomplete, Incomplete]]: ...
) -> tuple[int | Incomplete, dict[Incomplete, dict[Incomplete, Incomplete]]]: ...
@_dispatchable
def cost_of_flow(G: Graph[_Node], flowDict: SupportsGetItem[Incomplete, Incomplete], weight: str = "weight") -> int | float: ...
@_dispatchable
def max_flow_min_cost(
G: Graph[_Node], s: str, t: str, capacity: str = "capacity", weight: str = "weight"
) -> dict[Incomplete, dict[Incomplete, Incomplete]]: ...
) -> tuple[int | Incomplete, dict[Incomplete, dict[Incomplete, Incomplete]]]: ...
4 changes: 3 additions & 1 deletion stubs/networkx/networkx/algorithms/isomorphism/ismags.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ from _typeshed import Incomplete
from collections.abc import Callable, Generator, Hashable, Iterable
from typing import Any

from ...classes.graph import Graph, _Node

__all__ = ["ISMAGS"]

def are_all_equal(iterable: Iterable[Any]) -> bool: ...
Expand All @@ -21,7 +23,7 @@ class ISMAGS:
graph: Incomplete
subgraph: Incomplete

def __init__(self, graph, subgraph, node_match=None, edge_match=None, cache=None) -> None: ...
def __init__(self, graph: Graph[_Node], subgraph: Graph[_Node], node_match=None, edge_match=None, cache=None) -> None: ...
def create_aligned_partitions(self, thing_matcher, sg_things, g_things): ...
def find_isomorphisms(self, symmetry: bool = True) -> Generator[Incomplete, Incomplete, Incomplete]: ...
def largest_common_subgraph(self, symmetry: bool = True) -> Generator[Incomplete, Incomplete, None]: ...
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from _typeshed import Incomplete
from collections.abc import Generator

from ...classes.graph import Graph, _Node

__all__ = ["GraphMatcher", "DiGraphMatcher"]

class GraphMatcher:
Expand All @@ -12,7 +14,7 @@ class GraphMatcher:
old_recursion_limit: Incomplete
test: str

def __init__(self, G1, G2) -> None: ...
def __init__(self, G1: Graph[_Node], G2: Graph[_Node]) -> None: ...
def reset_recursion_limit(self) -> None: ...
def candidate_pairs_iter(self) -> Generator[Incomplete, None, None]: ...
core_1: Incomplete
Expand All @@ -34,7 +36,7 @@ class GraphMatcher:
def syntactic_feasibility(self, G1_node, G2_node): ...

class DiGraphMatcher(GraphMatcher):
def __init__(self, G1, G2) -> None: ...
def __init__(self, G1: Graph[_Node], G2: Graph[_Node]) -> None: ...
def candidate_pairs_iter(self) -> Generator[Incomplete, None, None]: ...
core_1: Incomplete
core_2: Incomplete
Expand Down
25 changes: 13 additions & 12 deletions stubs/networkx/networkx/algorithms/isomorphism/matchhelpers.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from _typeshed import Incomplete
from collections.abc import Callable, Iterable
from types import FunctionType

from networkx.utils.backends import _dispatchable
Expand All @@ -18,23 +19,23 @@ __all__ = [
def copyfunc(f, name=None) -> FunctionType: ...
def allclose(x, y, rtol: float = 1.0000000000000001e-05, atol=1e-08) -> bool: ...
@_dispatchable
def categorical_node_match(attr, default): ...

categorical_edge_match: Incomplete
def categorical_node_match(attr: str | Iterable[str], default): ...

# Same as categorical_node_match, but not dispatchable
def categorical_edge_match(attr: str | Iterable[str], default): ...
@_dispatchable
def categorical_multiedge_match(attr, default): ...
def categorical_multiedge_match(attr: str | Iterable[str], default): ...
@_dispatchable
def numerical_node_match(attr, default, rtol: float = 1e-05, atol: float = 1e-08): ...

numerical_edge_match: Incomplete
def numerical_node_match(attr: str | Iterable[str], default, rtol: float = 1e-05, atol: float = 1e-08): ...

# Same as numerical_node_match, but not dispatchable
def numerical_edge_match(attr: str | Iterable[str], default, rtol: float = 1e-05, atol: float = 1e-08): ...
@_dispatchable
def numerical_multiedge_match(attr, default, rtol: float = 1e-05, atol: float = 1e-08): ...
def numerical_multiedge_match(attr: str | Iterable[str], default, rtol: float = 1e-05, atol: float = 1e-08): ...
@_dispatchable
def generic_node_match(attr, default, op): ...

generic_edge_match: Incomplete
def generic_node_match(attr: str | Iterable[str], default, op: Callable[[Incomplete, Incomplete], Incomplete]): ...

# Same as generic_node_match, but not dispatchable
def generic_edge_match(attr: str | Iterable[str], default, op: Callable[[Incomplete, Incomplete], Incomplete]): ...
@_dispatchable
def generic_multiedge_match(attr, default, op): ...
def generic_multiedge_match(attr: str | Iterable[str], default, op: Callable[[Incomplete, Incomplete], Incomplete]): ...
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from _typeshed import Incomplete

from ...classes.graph import Graph, _Node
from .isomorphvf2 import DiGraphMatcher, GraphMatcher

__all__ = ["TimeRespectingGraphMatcher", "TimeRespectingDiGraphMatcher"]
Expand All @@ -8,7 +9,7 @@ class TimeRespectingGraphMatcher(GraphMatcher):
temporal_attribute_name: Incomplete
delta: Incomplete

def __init__(self, G1, G2, temporal_attribute_name, delta) -> None: ...
def __init__(self, G1: Graph[_Node], G2: Graph[_Node], temporal_attribute_name, delta) -> None: ...
def one_hop(self, Gx, Gx_node, neighbors): ...
def two_hop(self, Gx, core_x, Gx_node, neighbors): ...
def semantic_feasibility(self, G1_node, G2_node): ...
Expand All @@ -17,7 +18,7 @@ class TimeRespectingDiGraphMatcher(DiGraphMatcher):
temporal_attribute_name: Incomplete
delta: Incomplete

def __init__(self, G1, G2, temporal_attribute_name, delta) -> None: ...
def __init__(self, G1: Graph[_Node], G2: Graph[_Node], 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): ...
def one_hop(self, Gx, Gx_node, core_x, pred, succ): ...
Expand Down
Loading