Mark As Completed Discussion

Good morning! Here's our prompt for today.

Question

Given a graph, can you use two colors to color each node of the graph, such that no two adjacent nodes have the same color?

Description

The Problem

The graph coloring problem is a well-known problem in computer science. It requires coloring different nodes of the graph so that two adjacent nodes do not have the same color.

In this challenge, we'll look at a special case of this problem, where we'll determine if two colors suffice for graph coloring or not. The 2 coloring problem is also equivalent to creating a partition of a set of elements, so that two connected elements are in two different partitions.

Try to solve this here or in Interactive Mode.

How do I practice this challenge?

JAVASCRIPT
OUTPUT
:001 > Cmd/Ctrl-Enter to run, Cmd/Ctrl-/ to comment

Here's our guided, illustrated walk-through.

How do I use this guide?