Details: name 'Graph' is not defined

My shortest path algorithm passes syntax checks but throws a failing error in unitests:

Failed test case: Failed to find the optimal solution for path between nodes

I think my error points back to the calling application which would be the grader. In some circumstances my code returns:

float(‘inf’),

instead of

dist, path

hence it found something triggering this result, any thoughts might help

thanks

Hi!

It looks like your algorithm cannot find the optimal solution between two nodes, not about this specific return. If the optimal solution exists, then your algorithm should be able to find it. I’d suggest creating the graph where your case fails and debug it.

Let me know if you still encounter difficulties.

Thanks,
Lucas

There must be something wrong. My assignment runs without errors and everything passes. Yet I am not getting any credit. Nor am I getting any clue that I have not explored. I have done a lot of work since my last post.

I have apparently stumped both GPT 4.0 and Gemini 1.5. I am stuck. All four unittests return:

There was a problem compiling the code from your notebook, please check that you saved before submitting. Details: name ‘Graph’ is not defined

Could someone please look at my code?

Perhaps if you revert the assignment in the original case and redo it, might get you though. I am doubting that you might have removed some parts of the code you are not supposed to…

File-> Revert Notebook to Checkpoint

Check this too!

Please give me something I can work with. I have tried all the ‘reload’ facilities to no avail. I have no feedback. Obviously, the ‘Graph’ object is not being called and I have no indication as to why this is the case. It is very frustrating for my code to run without error or warning in the context of not being able to completely trace its activities. Indeed, my code is completing without any ado, and in fact it is congratulating me on completing the assignment. Yet none of my code is receiving anything except 0; I must be doing something right! I have nowhere to go! I don’t understand the ‘Labs’ notebook. What are all the 'Unititled.ipynb’s building in my directory? Where can I find the directory for the files required to run my notebook? There is promise within the instructions that I will receive feedback, as well as invitation to ask for help, and I am reluctant to ask, but I have run out of options to figure-this-out.

Hello Doug,

We are volunteer mentors here trying to help learners, you need to understand that!

Now, did you try revert back to checkpoint? Save your current work or download it first. Then revert back and try filling it up again, when you revert back the notebook also do Kernel-> Shut Down All Kernels, and then Kernel → Restart Kernel.

Try these, I am also doing these labs at the moment.

I do understand. I am an all-in advocate for online learning. And I appreciate your effort to support it. I know I can be offensive, but I don’t mean to offend, and I can’t help being assertive. I apologize for being a jerk. In my view it is not fair for Coursera to rely on your service yet deny you the transparency tools to monitor what is behind the curtain.

I have not found a way to zero out my work and start over which seems like the only alternative.

I think I found a bug in the data. The tsp_medium_graph.joblib and the tsp_small_graph.joblib files have the ‘editable’ flag set to ‘True’, although it is locked-down so tight this is probably inconsequential. A bug nevertheless.

Hello @Doug_Epling!

If you’re encountering an error like “name {object} is not defined” in your notebook, despite it appearing to be defined, it’s likely because you’ve either moved the Graph implementation to a different cell or deleted the cell where the Graph was initially implemented and then created a new one. The autograder checks specific cells for your code, so if these changes were made, it will not be able to locate the necessary objects.

I’d suggest refreshing your workspace and copying your solution to the graded cells in the new notebook.

I hope it helps.

Best,
Lucas

Many thanks.

No worries Doug, what Lucas suggested I was also suggesting above, if you have reseted the notebook you can try to fill it and submit again! Let us know how it goes!

See, I like the idea of starting with a fresh copy of the lab. Link however, does not jive with V.4.0.7 of the Jupyter lab notebook the course supplies. For example, there are two options for ‘File → Open’ and these are ‘Open from file’, or ‘Open from path’. Since I know nothing of the evironmental path things work in nor the url to a new copy of the assignment, I am at a loss. The rest of those steps are equally confusing. Perhaps there has been an upgrade to Jupyter lab unassiated with the lab in the assignment. In any case, while excellent advisement, seems unworkable.

I think those instructions are inherited from the courses that entirely use Jupyter Notebooks via Coursera Labs.

They don’t seem to apply to this course which uses Jupyter Labs.

@lucas.coutinho , I think the text for “refreshing your workspace” for this course needs an update.

I am sorry to bother because I know the cadre for this course remains extremely busy helping others in this ~10K student course. I screwed up my digital coursework in this class, I have been stuck in the same place for almost a week. All I need, is a reset which I do not control. Just wipe the slate clean, and I will start over at the beginning. I have copious copies to facilitate. It seems I really screwed something up, and I am sorry. Thanks.

Thanks @TMosh,

I have updated the instructions.

@Doug_Epling,

Please follow the instructions here to get a fresh new copy of the assignment.

You can also, after getting a new copy, click in “Reboot”.

There are no ‘instructions’ at the URL you reference.

I think the instructions boil down to “delete the files” and then use “Get latest version”.