From unknown CodePlex user on Wednesday, 28 September 2011 23:42:12
I intend to use the Bellman-Ford algorithm to perform negative cycle detection. It appears to me that there is something wrong in the implementation of the algorithm (source revision quickgraph-60730). In BellmanFordShortestPathAlgorithm.cs, line 229:230
if (edgeWeight < 0)
throw new InvalidOperationException("non negative edge weight");
It is not clear to me why the algorithm should fail on non-negative edge weights, since the main use of the Bellman-Ford algorithm is for shortest path in the presence of negative weights.
There is also something strange with the description:
/// true if successful, false if there was a negative cycle.
protected override void InternalCompute()
The documentation suggests a boolean return, but the implementation is for void.
From unknown CodePlex user on Wednesday, 28 September 2011 23:42:12
I intend to use the Bellman-Ford algorithm to perform negative cycle detection. It appears to me that there is something wrong in the implementation of the algorithm (source revision quickgraph-60730). In BellmanFordShortestPathAlgorithm.cs, line 229:230 if (edgeWeight < 0) throw new InvalidOperationException("non negative edge weight"); It is not clear to me why the algorithm should fail on non-negative edge weights, since the main use of the Bellman-Ford algorithm is for shortest path in the presence of negative weights. There is also something strange with the description: ///true if successful, false if there was a negative cycle.
protected override void InternalCompute()
The documentation suggests a boolean return, but the implementation is for void.