A graph is considered bipartite if itβs possible to colorize it with two colors such that no two adjacent vertices have the same color.
Determining if a graph is bipartite can help identify specific structures and properties, enabling efficient problem-solving in domains such as scheduling, resource allocation, and conflict resolution. Bipartite graphs also allow for simpler algorithms and optimizations in tasks like maximum matching and graph coloring.
You are given an undirected graph with v vertices and e edges. You should check if the graph is bipartite or not.
Input
The first line of the input contains two integers v (1 β€ v β€ 100 000) and e (1 β€ e β€ 100 000).
The following e lines contain pairs of integers v1, v2 (1 β€ v1, v2 β€ v) which means that the vertex v1 is connected to the vertex v2 and vice versa.
Output
The program should print Yes if the given graph is bipartite and No otherwise.