@@ -6,7 +6,17 @@ import optype.numpy as onp
66
77import scipy .sparse as sparse
88from ._types import ScalarType , csr_arr
9- from scipy .sparse .csgraph import breadth_first_order , breadth_first_tree , depth_first_order , depth_first_tree
9+ from scipy .sparse .csgraph import (
10+ bellman_ford ,
11+ breadth_first_order ,
12+ breadth_first_tree ,
13+ depth_first_order ,
14+ depth_first_tree ,
15+ dijkstra ,
16+ floyd_warshall ,
17+ minimum_spanning_tree ,
18+ shortest_path ,
19+ )
1020
1121assert_type (breadth_first_order (csr_arr , 0 , return_predecessors = True ), tuple [onp .Array1D [np .int32 ], onp .Array1D [np .int32 ]])
1222
@@ -21,3 +31,22 @@ assert_type(depth_first_order(csr_arr, 0, True, False), onp.Array1D[np.int32])
2131assert_type (depth_first_order (csr_arr , 0 ), tuple [onp .Array1D [np .int32 ], onp .Array1D [np .int32 ]])
2232
2333assert_type (depth_first_tree (csr_arr , 0 ), sparse .csr_array [ScalarType , tuple [int , int ]])
34+
35+ assert_type (bellman_ford (csr_arr ), onp .Array2D [np .float64 ])
36+ assert_type (bellman_ford (csr_arr , return_predecessors = True ), tuple [onp .Array2D [np .float64 ], onp .Array2D [np .int32 ]])
37+
38+ assert_type (minimum_spanning_tree (csr_arr ), sparse .csr_array [ScalarType , tuple [int , int ]])
39+
40+ assert_type (shortest_path (csr_arr ), onp .Array2D [np .float64 ])
41+ assert_type (shortest_path (csr_arr , return_predecessors = True ), tuple [onp .Array2D [np .float64 ], onp .Array2D [np .int32 ]])
42+
43+ assert_type (floyd_warshall (csr_arr ), onp .Array2D [np .float64 ])
44+ assert_type (floyd_warshall (csr_arr , return_predecessors = True ), tuple [onp .Array2D [np .float64 ], onp .Array2D [np .int32 ]])
45+
46+ assert_type (dijkstra (csr_arr ), onp .Array2D [np .float64 ])
47+ assert_type (dijkstra (csr_arr , return_predecessors = True ), tuple [onp .Array2D [np .float64 ], onp .Array2D [np .int32 ]])
48+ assert_type (dijkstra (csr_arr , min_only = True ), onp .Array1D [np .float64 ])
49+ assert_type (
50+ dijkstra (csr_arr , True , None , True , False , np .inf , min_only = True ),
51+ tuple [onp .Array1D [np .float64 ], onp .Array1D [np .int32 ], onp .Array1D [np .int32 ]],
52+ )
0 commit comments