LeetCodeTopInterviewQuestions
Leetcode Top Interview questions discussed in Leetcode. https://leetcode.com/explore/interview/card/top-interview-questions-easy/
Also Question answered from CodeSignal.com : https://app.codesignal.com/
Posted on April 3, 2022
A Bipartite Graph is a graph whose vertices can be divided into two independent sets, U and V such that every edge (u, v) either connects a vertex from U to V or a vertex from V to U.
Image is taken from GFG
In simple words, a graph is said to be a Bipartite Graph if we are able to colour the graph using 2 colours such that no adjacent nodes have the same colour.
If the graph has an odd length cycle, it is not a bipartite graph.
Two vertices of the same set will be connected, which contradicts the Bipartite definition saying there are two sets of vertices and no vertex will be connected with any other vertex of the same set.
If the graph has an even length cycle, it is said to be a bipartite graph.
Breadth-First Search is used to determine whether a graph is Bipartite or not a Bipartite graph.
Originally Published on : LinkedIn Newsletter
Leetcode Top Interview questions discussed in Leetcode. https://leetcode.com/explore/interview/card/top-interview-questions-easy/
Also Question answered from CodeSignal.com : https://app.codesignal.com/
Posted on April 3, 2022
Sign up to receive the latest update from our blog.