How might greedy ever be a synonym of parsimonious?

thesaurus.com puts 'avaricious' at the top of its list of synonyms for 'parsimonious', and 'greedy' a little further down. To my mind, an essential sense of parsimony is self-denial.

The only way I can imagine 'greedy' as a synonym would be via the idea that lack of generosity to others might be accompanied by self-interest. I think 'stingy' could be used to describe this pair of traits. But surely 'parsimonious' implies frugality in general, and 'greedy' would be more an antonym than a synonym?


I searched with Google for

"parsimonoious algorithm" greedy

I found many examples in mathematics and computer science where an algorithm is called both "parsimonious" and "greedy".

For example, the text Discrete Mathematics with Ducks by sarah-marie belcastro. There is an exercise on page 374:

(a) Design a greedy (parsimonious) algorithm for coloring the vertices of a graph...