This is the pseudo-code for the Floyd-Warshall algorithm for shortest paths detection:
I was wondering if it would be possible to add a check that will test if there are no cycles with negative weights?
I think it is possible, but I do not know how to check.