XYZ Encryption in Graph

Used union-rank algorithm to get the output.Not sure wjetjer the approach is the right one. Please check https://ide.codingblocks.com/s/184260.

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 $S_1$ is a set of nodes with value ā€œxā€, and set
$S_2$ is a set of nodes with value ā€œzā€, then interchanging them will not change the encrypted
graph, i.e. assign value ā€œzā€ to set $S_1$ and value ā€œxā€ to set $S_2$. 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.

@chhavibansal , can it not be possible that there exist a another arrangement of x , y, z that will give us YES.
PLEASE REPLY

what other combination do u think can be feasible?
please state example

yes you are right.
thanks .

1 Like