mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-03-03 14:01:27 -05:00
928 B
928 B
id, title, challengeType, dashedName
| id | title | challengeType | dashedName |
|---|---|---|---|
| 655773b0591c5f9f4045883e | Step 19 | 20 | step-19 |
--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 accept graph and start as the parameters, in this order.
({ test: () => assert(__pyodide.runPython(`
import inspect
f = __locals.get("shortest_path")
sig = str(inspect.signature(f))
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--