algorithm greedy finished, graph printer works