Week 3 assignment - negative edge weights?

I can’t seem to find the information if in the graded lab’s test data the edge weights are allowed to be negative. Also if there are possible negative cycles. This seems relevant for what algorithm should be implemented. Could anyone clarify this issue?

In the lab’s playground, in the generate_graph(), the weights default to positive, so I’m going to assume the same holds for the grading test data and move on.

Hi @wyrm !

You can start by assuming the edge weights are positive (most probable), just as in the playground’s generate_graph() function. If your solution doesn’t pass the grading tests and you’re sure that your code is correct, you might then consider handling negative weights as well.

Feel free to reach out if you need more guidance, and good luck!

2 Likes

Assume the weights are positive.

2 Likes