algorithm graph_algorithm shortest_path greedy single_source label_setting combinatorial_optimization deterministic weighted_graph nonnegative_weights pathfinding polynomial_time