accomplish dag shortest paths algorithm