Bipartite Graphs

A challenge by mousetail avatar mousetail

Description

According to Wikipedia a bipartite graph is the following:

In the mathematical field of graph theory, a bipartite graph (or bigraph) is a graph whose vertices can be divided into two disjoint and independent sets U and V, that is, every edge connects a vertex in U to one in V. Vertex sets U and V are usually called the parts of the graph. Equivalently, a bipartite graph is a graph that does not contain any odd-length cycles.

Your task is, given a list of graphs, output only the graphs that are bipartite.

Input Format

The input format will be: One graph per line, a space separated list of node indexes that the nth node connects to. For example

1 0,2 1

This means that node 0 has an edge to 1, 1 has edges to 0 and 2, and finally, node 2 has one edge to node 1.

This challenge is a sub task of the Graph Planarity challenge

Leaderboard

Author Bytes
No solutions yet
Challenge ended 24 April 2026 ago
This challenge has ended. You are free to submit more solutions but they won't count for scoring.