×
×
Correct!
Insert the missing method to find the shortest path in a graph from one element to another:
import numpy as np
from scipy.sparse.csgraph import dijkstra
from scipy.sparse import csr_matrix
arr = np.array([
[0, 1, 2],
[1, 0, 0],
[2, 0, 0]
])
newarr = csr_matrix(arr)
print(@(8)(newarr, return_predecessors=True, indices=0))
import numpy as np
from scipy.sparse.csgraph import dijkstra
from scipy.sparse import csr_matrix
arr = np.array([
[0, 1, 2],
[1, 0, 0],
[2, 0, 0]
])
newarr = csr_matrix(arr)
print(dijkstra(newarr, return_predecessors=True, indices=0))
Not CorrectClick here to try again. Correct! |
This will reset the score of ALL 20 exercises.
Are you sure you want to continue?