Algorithms and Data Structures · Middle · Question 61 of 75

How do you check if a graph can be colored with two colors so that no edge connects equal colors?

Explanation

Such a graph is bipartite. A conflict means there's an odd cycle, and then two colors aren't enough. Typical problem: split people into two teams where rivals end up in different teams.

Further reading

Problem with a question

Algorithms and Data Structures · Middle · question 61

Test yourself

Take the Algorithms and Data Structures · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz