liveBook · Manning

Bipartite graph

As explained in Advanced Algorithms and Data Structures

A bipartite graph is a graph whose vertices can be partitioned into two groups with edges only between the groups; in this section the graph is also required to be connected.

A bipartite graph is a connected graph whose vertices can be divided into two groups, A and B, with every edge joining one group to the other. No edge joins two vertices within the same group. section 15.1.2

A complete bipartite graph contains every possible edge between its partitions. It is written Kₙ,ₘ, where the two groups contain n and m vertices; it has exactly n·m edges. K₃,₃ therefore has six vertices and nine edges. section 15.1.2 section 15.2.3

To test a connected graph, start with one vertex, assign it one color, and traverse the graph with BFS. Assign every uncolored neighbor the opposite color. If an edge connects vertices with the same color, the graph is not bipartite; otherwise, the two color classes are the partitions. section 15.2.3

A practical implementation maintains:

  • Two resulting color classes, returned as the graph’s partitions when no conflict appears. section 15.2.3

Recognizing K₃,₃

A graph is a candidate for K₃,₃ when it has six vertices and nine simple edges. It qualifies only if it is bipartite and its two partitions each contain three vertices. section 15.2.3

How Advanced Algorithms and Data Structures covers it

How deep it goes
Defines partitions and complete variants, then gives a BFS-based coloring procedure that returns partitions but omits running-time analysis.
Examples
Uses K₃,₃, red-and-blue vertex coloring, adjacency lists, queues, and contrasting bipartite and non-bipartite diagrams.
What it assumes
Assumes graph vertices, edges, adjacency lists, queues, and BFS; teaches the partition definition and coloring test explicitly.
What you can do after
Diagnose bipartiteness with BFS coloring and recover the two vertex partitions for a connected graph.
How it connects
Connects bipartite graphs with graph coloring, breadth-first search, complete bipartite graphs, K₃,₃, and planarity testing.

Also explained in

Compare how 3 books explain bipartite graph →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Advanced Algorithms and Data Structures. The section links point to the parts of the book it draws on.