Not getting idea about how to implement it. I know that if 2 nodes are not connected then they must be assigned x and z respectively.
Implementation doubt
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.
The code to implement this https://ide.codingblocks.com/s/340582