@@ -35,6 +35,7 @@ from rustworkx import generators # noqa
3535from typing_extensions import Self
3636
3737import numpy as np
38+ import numpy .typing as npt
3839import sys
3940
4041if sys .version_info >= (3 , 13 ):
@@ -206,15 +207,15 @@ def digraph_adjacency_matrix(
206207 default_weight : float = ...,
207208 null_value : float = ...,
208209 parallel_edge : str = ...,
209- ) -> np .ndarray : ...
210+ ) -> npt . NDArray [ np .float64 ] : ...
210211def graph_adjacency_matrix (
211212 graph : PyGraph [_S , _T ],
212213 / ,
213214 weight_fn : Callable [[_T ], float ] | None = ...,
214215 default_weight : float = ...,
215216 null_value : float = ...,
216217 parallel_edge : str = ...,
217- ) -> np .ndarray : ...
218+ ) -> npt . NDArray [ np .float64 ] : ...
218219def cycle_basis (graph : PyGraph , / , root : int | None = ...) -> list [list [int ]]: ...
219220def articulation_points (graph : PyGraph , / ) -> set [int ]: ...
220221def bridges (graph : PyGraph , / ) -> set [tuple [int ]]: ...
@@ -595,14 +596,14 @@ def undirected_gnp_random_graph(
595596) -> PyGraph : ...
596597def directed_sbm_random_graph (
597598 sizes : list [int ],
598- probabilities : np .ndarray ,
599+ probabilities : npt . NDArray [ np .float64 ] ,
599600 loops : bool ,
600601 / ,
601602 seed : int | None = ...,
602603) -> PyDiGraph : ...
603604def undirected_sbm_random_graph (
604605 sizes : list [int ],
605- probabilities : np .ndarray ,
606+ probabilities : npt . NDArray [ np .float64 ] ,
606607 loops : bool ,
607608 / ,
608609 seed : int | None = ...,
@@ -863,13 +864,13 @@ def digraph_distance_matrix(
863864 parallel_threshold : int | None = ...,
864865 as_undirected : bool | None = ...,
865866 null_value : float | None = ...,
866- ) -> np .ndarray : ...
867+ ) -> npt . NDArray [ np .float64 ] : ...
867868def graph_distance_matrix (
868869 graph : PyGraph ,
869870 / ,
870871 parallel_threshold : int | None = ...,
871872 null_value : float | None = ...,
872- ) -> np .ndarray : ...
873+ ) -> npt . NDArray [ np .float64 ] : ...
873874def digraph_floyd_warshall (
874875 graph : PyDiGraph [_S , _T ],
875876 / ,
@@ -892,29 +893,29 @@ def digraph_floyd_warshall_numpy(
892893 as_undirected : bool | None = ...,
893894 default_weight : float | None = ...,
894895 parallel_threshold : int | None = ...,
895- ) -> np .ndarray : ...
896+ ) -> npt . NDArray [ np .float64 ] : ...
896897def graph_floyd_warshall_numpy (
897898 graph : PyGraph [_S , _T ],
898899 / ,
899900 weight_fn : Callable [[_T ], float ] | None = ...,
900901 default_weight : float | None = ...,
901902 parallel_threshold : int | None = ...,
902- ) -> np .ndarray : ...
903+ ) -> npt . NDArray [ np .float64 ] : ...
903904def digraph_floyd_warshall_successor_and_distance (
904905 graph : PyDiGraph [_S , _T ],
905906 / ,
906907 weight_fn : Callable [[_T ], float ] | None = ...,
907908 as_undirected : bool | None = ...,
908909 default_weight : float | None = ...,
909910 parallel_threshold : int | None = ...,
910- ) -> tuple [np .ndarray , np .ndarray ]: ...
911+ ) -> tuple [npt . NDArray [ np .float64 ], npt . NDArray [ np .float64 ] ]: ...
911912def graph_floyd_warshall_successor_and_distance (
912913 graph : PyGraph [_S , _T ],
913914 / ,
914915 weight_fn : Callable [[_T ], float ] | None = ...,
915916 default_weight : float | None = ...,
916917 parallel_threshold : int | None = ...,
917- ) -> tuple [np .ndarray , np .ndarray ]: ...
918+ ) -> tuple [npt . NDArray [ np .float64 ], npt . NDArray [ np .float64 ] ]: ...
918919def find_negative_cycle (
919920 graph : PyDiGraph [_S , _T ],
920921 edge_cost_fn : Callable [[_T ], float ],
@@ -1079,7 +1080,9 @@ class _RustworkxCustomVecIter(Generic[_T_co], Sequence[_T_co], ABC):
10791080 def __len__ (self ) -> int : ...
10801081 def __ne__ (self , other : object ) -> bool : ...
10811082 def __setstate__ (self , state : Sequence [_T_co ]) -> None : ...
1082- def __array__ (self , dtype : np .dtype | None = ..., copy : bool | None = ...) -> np .ndarray : ...
1083+ def __array__ (
1084+ self , dtype : np .dtype [Any ] | None = ..., copy : bool | None = ...
1085+ ) -> npt .NDArray [Any ]: ...
10831086 def __iter__ (self ) -> Iterator [_T_co ]: ...
10841087 def __reversed__ (self ) -> Iterator [_T_co ]: ...
10851088
@@ -1235,11 +1238,11 @@ class PyGraph(Generic[_S, _T]):
12351238 ) -> int | None : ...
12361239 @staticmethod
12371240 def from_adjacency_matrix (
1238- matrix : np .ndarray , / , null_value : float = ...
1241+ matrix : npt . NDArray [ np .float64 ] , / , null_value : float = ...
12391242 ) -> PyGraph [int , float ]: ...
12401243 @staticmethod
12411244 def from_complex_adjacency_matrix (
1242- matrix : np .ndarray , / , null_value : complex = ...
1245+ matrix : npt . NDArray [ np .complex64 ] , / , null_value : complex = ...
12431246 ) -> PyGraph [int , complex ]: ...
12441247 def get_all_edge_data (self , node_a : int , node_b : int , / ) -> list [_T ]: ...
12451248 def get_edge_data (self , node_a : int , node_b : int , / ) -> _T : ...
@@ -1400,11 +1403,11 @@ class PyDiGraph(Generic[_S, _T]):
14001403 ) -> list [_S ]: ...
14011404 @staticmethod
14021405 def from_adjacency_matrix (
1403- matrix : np .ndarray , / , null_value : float = ...
1406+ matrix : npt . NDArray [ np .float64 ] , / , null_value : float = ...
14041407 ) -> PyDiGraph [int , float ]: ...
14051408 @staticmethod
14061409 def from_complex_adjacency_matrix (
1407- matrix : np .ndarray , / , null_value : complex = ...
1410+ matrix : npt . NDArray [ np .complex64 ] , / , null_value : complex = ...
14081411 ) -> PyDiGraph [int , complex ]: ...
14091412 def get_all_edge_data (self , node_a : int , node_b : int , / ) -> list [_T ]: ...
14101413 def get_edge_data (self , node_a : int , node_b : int , / ) -> _T : ...
0 commit comments