Project 21: Song Similarity Path Finder
Scientific Computing
Current Task
Objective
Review day: reuse shortest_path — day 10 — for a song-similarity graph instead of distances.
Task: compute all-pairs shortest paths over a song similarity matrix and print the result.
index.py
from scipy.sparse.csgraph import shortest_path
import numpy as np
song_similarity = np.array([
[0, 1, 0],
[1, 0, 3],
[0, 3, 0]
])
result = shortest_path(song_similarity)
print(result)
* Hint: Correct characters turn green, incorrect ones turn red.
Live Preview
🖼️
Verify your code to see the preview