adding shortest paths algorithms in C++