|
1 | 1 | from _typeshed import Incomplete
|
| 2 | +from collections.abc import Callable |
2 | 3 |
|
| 4 | +from networkx.classes.digraph import DiGraph |
| 5 | +from networkx.classes.graph import Graph, _Node |
3 | 6 | from networkx.utils.backends import _dispatchable
|
| 7 | +from numpy.random import RandomState |
4 | 8 |
|
5 | 9 | @_dispatchable
|
6 |
| -def christofides(G, weight: str = "weight", tree: Incomplete | None = None): ... |
| 10 | +def christofides(G: Graph[_Node], weight: str | None = "weight", tree: Graph[_Node] | None = None): ... |
7 | 11 | @_dispatchable
|
8 | 12 | def traveling_salesman_problem(
|
9 |
| - G, weight: str = "weight", nodes: Incomplete | None = None, cycle: bool = True, method: Incomplete | None = None, **kwargs |
| 13 | + G: Graph[_Node], |
| 14 | + weight: str = "weight", |
| 15 | + nodes=None, |
| 16 | + cycle: bool = True, |
| 17 | + method: Callable[..., Incomplete] | None = None, |
| 18 | + **kwargs, |
10 | 19 | ): ...
|
11 | 20 | @_dispatchable
|
12 |
| -def asadpour_atsp(G, weight: str = "weight", seed: Incomplete | None = None, source: Incomplete | None = None): ... |
| 21 | +def asadpour_atsp( |
| 22 | + G: DiGraph[_Node], weight: str | None = "weight", seed: int | RandomState | None = None, source: str | None = None |
| 23 | +): ... |
13 | 24 | @_dispatchable
|
14 |
| -def greedy_tsp(G, weight: str = "weight", source: Incomplete | None = None): ... |
| 25 | +def greedy_tsp(G: Graph[_Node], weight: str | None = "weight", source=None): ... |
15 | 26 | @_dispatchable
|
16 | 27 | def simulated_annealing_tsp(
|
17 |
| - G, |
| 28 | + G: Graph[_Node], |
18 | 29 | init_cycle,
|
19 |
| - weight: str = "weight", |
20 |
| - source: Incomplete | None = None, |
21 |
| - # docstring says int, but it can be a float and does become a float mid-equation if alpha is also a float |
22 |
| - temp: float = 100, |
23 |
| - move: str = "1-1", |
24 |
| - max_iterations: int = 10, |
25 |
| - N_inner: int = 100, |
26 |
| - alpha: float = 0.01, |
27 |
| - seed: Incomplete | None = None, |
| 30 | + weight: str | None = "weight", |
| 31 | + source=None, |
| 32 | + temp: int | None = 100, |
| 33 | + move="1-1", |
| 34 | + max_iterations: int | None = 10, |
| 35 | + N_inner: int | None = 100, |
| 36 | + alpha=0.01, |
| 37 | + seed: int | RandomState | None = None, |
28 | 38 | ): ...
|
29 | 39 | @_dispatchable
|
30 | 40 | def threshold_accepting_tsp(
|
31 |
| - G, |
| 41 | + G: Graph[_Node], |
32 | 42 | init_cycle,
|
33 |
| - weight: str = "weight", |
34 |
| - source: Incomplete | None = None, |
35 |
| - threshold: float = 1, |
36 |
| - move: str = "1-1", |
37 |
| - max_iterations: int = 10, |
38 |
| - N_inner: int = 100, |
39 |
| - alpha: float = 0.1, |
40 |
| - seed: Incomplete | None = None, |
| 43 | + weight: str | None = "weight", |
| 44 | + source=None, |
| 45 | + threshold: int | None = 1, |
| 46 | + move="1-1", |
| 47 | + max_iterations: int | None = 10, |
| 48 | + N_inner: int | None = 100, |
| 49 | + alpha=0.1, |
| 50 | + seed: int | RandomState | None = None, |
41 | 51 | ): ...
|
0 commit comments