Feb. 21, 2014, 5:40 p.m. by Rosalind Team
Topics: Graphs
The task is to use Bellman-Ford algorithm to check whether a given graph contains a cycle of negative weight.
Given: A positive integer
Return: For each graph, output "1" if it contains a negative weight cycle and "-1" otherwise.
2 4 5 1 4 4 4 2 3 2 3 1 3 1 6 2 1 -7 3 4 1 2 -8 2 3 20 3 1 -1 3 2 -30
-1 1