But what is the "vertices" that needs to return?
Based on the name of the function, I imagine you should return a list of visited vertices in the order they are visited.
Unless I'm missing something, this would be the same as visited
, which is somewhat redundant. But visited
really should be a Set
for efficient lookup, which would make having vertices
make more sense.
But I can't know for sure what your teacher was thinking. You should probably go and ask them to make sure.
I'm assuming (based on your question) that you're not looking for help writing this function, just understanding this part.