Skip to content

Commit 97dc39b

Browse files
Fix generics in NetworkX (#13864)
1 parent dd85323 commit 97dc39b

2 files changed

Lines changed: 20 additions & 20 deletions

File tree

stubs/networkx/networkx/algorithms/shortest_paths/unweighted.pyi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ def single_target_shortest_path_length(G: Graph[_Node], target: _Node, cutoff: i
1111
@_dispatchable
1212
def all_pairs_shortest_path_length(G: Graph[_Node], cutoff: int | None = None) -> Generator[Incomplete, None, None]: ...
1313
@_dispatchable
14-
def bidirectional_shortest_path(G: Graph[_Node], source: str, target: str): ...
14+
def bidirectional_shortest_path(G: Graph[_Node], source: _Node, target: _Node): ...
1515
@_dispatchable
16-
def single_source_shortest_path(G: Graph[_Node], source: str, cutoff: int | None = None): ...
16+
def single_source_shortest_path(G: Graph[_Node], source: _Node, cutoff: int | None = None): ...
1717
@_dispatchable
18-
def single_target_shortest_path(G: Graph[_Node], target: str, cutoff: int | None = None): ...
18+
def single_target_shortest_path(G: Graph[_Node], target: _Node, cutoff: int | None = None): ...
1919
@_dispatchable
2020
def all_pairs_shortest_path(G: Graph[_Node], cutoff: int | None = None) -> Generator[Incomplete, None, None]: ...
2121
@_dispatchable
2222
def predecessor(
23-
G: Graph[_Node], source: str, target: str | None = None, cutoff: int | None = None, return_seen: bool | None = None
23+
G: Graph[_Node], source: _Node, target: _Node | None = None, cutoff: int | None = None, return_seen: bool | None = None
2424
): ...

stubs/networkx/networkx/algorithms/shortest_paths/weighted.pyi

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ def dijkstra_path(
1515
@_dispatchable
1616
def dijkstra_path_length(
1717
G: Graph[_Node],
18-
source: str,
19-
target: str,
18+
source: _Node,
19+
target: _Node,
2020
weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight",
2121
): ...
2222
@_dispatchable
@@ -29,15 +29,15 @@ def single_source_dijkstra_path(
2929
@_dispatchable
3030
def single_source_dijkstra_path_length(
3131
G: Graph[_Node],
32-
source: str,
32+
source: _Node,
3333
cutoff: float | None = None,
3434
weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight",
3535
): ...
3636
@_dispatchable
3737
def single_source_dijkstra(
3838
G: Graph[_Node],
39-
source: str,
40-
target: str | None = None,
39+
source: _Node,
40+
target: _Node | None = None,
4141
cutoff: float | None = None,
4242
weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight",
4343
): ...
@@ -59,14 +59,14 @@ def multi_source_dijkstra_path_length(
5959
def multi_source_dijkstra(
6060
G: Graph[_Node],
6161
sources,
62-
target: str | None = None,
62+
target: _Node | None = None,
6363
cutoff: float | None = None,
6464
weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight",
6565
): ...
6666
@_dispatchable
6767
def dijkstra_predecessor_and_distance(
6868
G: Graph[_Node],
69-
source: str,
69+
source: _Node,
7070
cutoff: float | None = None,
7171
weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight",
7272
): ...
@@ -91,8 +91,8 @@ def all_pairs_dijkstra_path(
9191
@_dispatchable
9292
def bellman_ford_predecessor_and_distance(
9393
G: Graph[_Node],
94-
source: str,
95-
target: str | None = None,
94+
source: _Node,
95+
target: _Node | None = None,
9696
weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight",
9797
heuristic: bool = False,
9898
): ...
@@ -106,8 +106,8 @@ def bellman_ford_path(
106106
@_dispatchable
107107
def bellman_ford_path_length(
108108
G: Graph[_Node],
109-
source: str,
110-
target: str,
109+
source: _Node,
110+
target: _Node,
111111
weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight",
112112
): ...
113113
@_dispatchable
@@ -116,13 +116,13 @@ def single_source_bellman_ford_path(
116116
): ...
117117
@_dispatchable
118118
def single_source_bellman_ford_path_length(
119-
G: Graph[_Node], source: str, weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight"
119+
G: Graph[_Node], source: _Node, weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight"
120120
): ...
121121
@_dispatchable
122122
def single_source_bellman_ford(
123123
G: Graph[_Node],
124-
source: str,
125-
target: str | None = None,
124+
source: _Node,
125+
target: _Node | None = None,
126126
weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight",
127127
): ...
128128
@_dispatchable
@@ -135,7 +135,7 @@ def all_pairs_bellman_ford_path(
135135
) -> Generator[Incomplete, None, None]: ...
136136
@_dispatchable
137137
def goldberg_radzik(
138-
G: Graph[_Node], source: str, weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight"
138+
G: Graph[_Node], source: _Node, weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight"
139139
): ...
140140
@_dispatchable
141141
def negative_edge_cycle(
@@ -145,7 +145,7 @@ def negative_edge_cycle(
145145
): ...
146146
@_dispatchable
147147
def find_negative_cycle(
148-
G: Graph[_Node], source: str, weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight"
148+
G: Graph[_Node], source: _Node, weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight"
149149
): ...
150150
@_dispatchable
151151
def bidirectional_dijkstra(

0 commit comments

Comments
 (0)