1
- from _typeshed import Incomplete
2
- from collections .abc import Callable
1
+ from collections .abc import Callable , Mapping
3
2
from typing_extensions import TypeAlias
4
3
5
4
from networkx .classes .graph import Graph , _Node
@@ -22,27 +21,43 @@ __all__ = [
22
21
23
22
@_dispatchable
24
23
def eccentricity (
25
- G : Graph [_Node ], v : _Node | None = None , sp = None , weight : str | _WeightFunction | None = None
26
- ) -> Incomplete | dict [Incomplete , Incomplete ]: ...
24
+ G : Graph [_Node ],
25
+ v : _Node | None = None ,
26
+ sp : Mapping [_Node , Mapping [_Node , int ]] | None = None ,
27
+ weight : str | _WeightFunction | None = None ,
28
+ ) -> int | dict [_Node , int ]: ... # TODO: overload on v: dict if v is None else int
27
29
@_dispatchable
28
- def diameter (G : Graph [_Node ], e = None , usebounds : bool = False , weight : str | _WeightFunction | None = None ): ...
30
+ def diameter (
31
+ G : Graph [_Node ], e : Mapping [_Node , int ] | None = None , usebounds : bool = False , weight : str | _WeightFunction | None = None
32
+ ) -> int : ...
29
33
@_dispatchable
30
- def harmonic_diameter (G , sp = None , * , weight : str | _WeightFunction | None = None ) -> float : ...
34
+ def harmonic_diameter (
35
+ G : Graph [_Node ], sp : Mapping [_Node , Mapping [_Node , int ]] | None = None , * , weight : str | _WeightFunction | None = None
36
+ ) -> float : ...
31
37
@_dispatchable
32
38
def periphery (
33
- G : Graph [_Node ], e = None , usebounds : bool = False , weight : str | _WeightFunction | None = None
34
- ) -> list [Incomplete ]: ...
39
+ G : Graph [_Node ], e : Mapping [ _Node , int ] | None = None , usebounds : bool = False , weight : str | _WeightFunction | None = None
40
+ ) -> list [_Node ]: ...
35
41
@_dispatchable
36
- def radius (G : Graph [_Node ], e = None , usebounds : bool = False , weight : str | _WeightFunction | None = None ): ...
42
+ def radius (
43
+ G : Graph [_Node ], e : Mapping [_Node , int ] | None = None , usebounds : bool = False , weight : str | _WeightFunction | None = None
44
+ ) -> int : ...
37
45
@_dispatchable
38
- def center (G : Graph [_Node ], e = None , usebounds : bool = False , weight : str | _WeightFunction | None = None ) -> list [Incomplete ]: ...
46
+ def center (
47
+ G : Graph [_Node ], e : Mapping [_Node , int ] | None = None , usebounds : bool = False , weight : str | _WeightFunction | None = None
48
+ ) -> list [_Node ]: ...
39
49
@_dispatchable
40
- def barycenter (G , weight : str | _WeightFunction | None = None , attr = None , sp = None ) -> list [Incomplete ]: ...
50
+ def barycenter (
51
+ G : Graph [_Node ],
52
+ weight : str | _WeightFunction | None = None ,
53
+ attr : str | None = None ,
54
+ sp : Mapping [_Node , Mapping [_Node , int ]] | None = None ,
55
+ ) -> list [_Node ]: ...
41
56
@_dispatchable
42
57
def resistance_distance (
43
- G : Graph [_Node ], nodeA = None , nodeB = None , weight : str | None = None , invert_weight : bool = True
44
- ) -> float | dict [Incomplete , float ]: ...
58
+ G : Graph [_Node ], nodeA : _Node | None = None , nodeB : _Node | None = None , weight : str | None = None , invert_weight : bool = True
59
+ ) -> float | dict [_Node , float ]: ... # TODO: overload on the nodes: float if both are specified else dict
45
60
@_dispatchable
46
- def effective_graph_resistance (G , weight : str | None = None , invert_weight : bool = True ) -> float : ...
61
+ def effective_graph_resistance (G : Graph [ _Node ] , weight : str | None = None , invert_weight : bool = True ) -> float : ...
47
62
@_dispatchable
48
- def kemeny_constant (G , * , weight : str | None = None ) -> float : ...
63
+ def kemeny_constant (G : Graph [ _Node ] , * , weight : str | None = None ) -> float : ...
0 commit comments