Yup. That answer is correct. In simpler terms, color vertices white and black alternately as they are explored in BFS order (child of a black node is white and vice versa). If you come across a colored vertex, check its color - if it is the same as what you wanted to give it then skip the node (already visited) else return false (contradiction found).
-- DK -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/CCPnSz7lfDoJ. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
