XYZ Encryption Problem hint

Could you please explain the approach to solve this problem.
I am thinking in direction of bipartite graphs

hi @arishhaq_ae3b72621f2b5e46,
First observation is that, if two nodes, u and v are not connected, then one of them is “x” and another one is “z”. Second observation is that if is a set of nodes with value “x”, and set is a set of nodes with value “z”, then interchanging them will not change the encrypted graph, i.e. assign value “z” to set and value “x” to set . So first we will search for a pair of nodes, u and v , which are not connected, assign one of them to “x” and another to “z”. Now for the rest of the nodes, if a node, w is connected to both u and v , assign value “y” to it. If a node, w is connected to node u only, then assign value “x” to it. If a node, w is connected to node v only, then assign value “z” to it. Now since you have assigned values to all of the nodes, for every pair of nodes, check whether it satisfies the rules of encryption. If it does not, then answer is NO.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.