greedy, graph representation, dynamic