mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-04-12 01:00:13 -04:00
890 B
890 B
id, title, challengeType, dashedName
| id | title | challengeType | dashedName |
|---|---|---|---|
| 655773b0591c5f9f4045883e | Step 24 | 20 | step-24 |
--description--
The algorithm will start at a specified node. Then it will explore the graph to find the shortest path between the starting node, or source, and all the other nodes.
For that your function needs two parameters: graph, and start. Add them to your function declaration.
--hints--
Your function should take graph and start as the parameters, in this order.
({ test: () => assert(runPython(`
import inspect
sig = str(inspect.signature(shortest_path))
sig == '(graph, start)'
`))
})
--seed--
--seed-contents--
--fcc-editable-region--
my_graph = {
'A': [('B', 3), ('D', 1)],
'B': [('A', 3), ('C', 4)],
'C': [('B', 4), ('D', 7)],
'D': [('A', 1), ('C', 7)]
}
def shortest_path():
pass
--fcc-editable-region--