Clariant interview question

How to solve a problem related to graphs