Open In App

What is Bipartite Graph?

Last Updated : 26 Sep, 2024
Summarize
Comments
Improve
Suggest changes
Share
Like Article
Like
Report

A bipartite graph can be colored with two colors such that no two adjacent vertices share the same color. This means we can divide the graph's vertices into two distinct sets where:

  • All edges connect vertices from one set to vertices in the other set.
  • No edges exist between vertices within the same set.

An alternate definition: Formally, a graph G = (V, E) is bipartite if and only if its vertex set V can be partitioned into two non-empty subsets X and Y, such that every edge in E has one endpoint in X and the other endpoint in Y. This partition of vertices is also known as bi-partition.

Characteristics of Bipartite Graph

The characteristics of a bipartite graph are as follows:

  • Vertices can be divided into two disjoint sets: A bipartite graph can be partitioned into two sets of vertices, with no edges between vertices within each set.
  • Every edge connects vertices in different sets: Every edge in a bipartite graph connects a vertex from one set to a vertex from the other set.
  • No odd-length cycles: A bipartite graph cannot contain any odd-length cycles, as this would require vertices from the same set to be connected by an edge.
  • Maximum degree is bounded by the size of the smaller set: The maximum degree of a vertex in a bipartite graph is equal to the size of the smaller set.
  • Coloring with two colors: A bipartite graph can be colored with two colors,, such that no adjacent vertices have the same color.

Example of Bipartite Graph

a2

Note: In the above image nodes of the same color belong to the same set.

How to identify Bipartite Graph?

To identify whether a given graph is bipartite, you can use the following algorithm:

  1. Choose any vertex in the graph and assign it to one of the two sets, say X.
  2. Assign all of its neighbors to the other set, say Y.
  3. For each vertex in set Y, assign all their unassigned neighbors to set X, and for each vertex in set X, assign all their unassigned neighbors to set Y.
  4. Check if any two adjacent vertices are in the same set. If yes, then the graph is not bipartite. Otherwise, it is bipartite.

To learn more about "How to identify", refer to this article.

Application of Bipartite Graph

Bipartite graphs have several important applications, including:

  • Bipartite graphs help solve matching problems. For example, they can assign tasks to employees or courses to students.
  • They can also create recommendation systems. One group represents users and the other represents items. If a user rates an item, a connection is made between them. This helps suggest items to users based on what they like.
  • Additionally, bipartite graphs can show relationships in social networks. One group represents people and the other represents groups. If someone belongs to a group, there’s a connection between them.
  • Bipartite graphs are instrumental in solving stable marriage problems and other matching scenarios.

Related Articles:


What is Bipartite Graph?
Practice Tags :

Similar Reads