Algorithm for finding single-source shortest paths in graphs, allowing some edge weights to be negative