This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

BipartiteGraphQ

BipartiteGraphQ[g]
yields True if the graph g is a bipartite graph and False otherwise.
  • A graph is bipartite if the vertices can be divided into two groups and all edges are between the groups.
Test whether a graph is bipartite:
A WheelGraph is not a bipartite graph:
Test whether a graph is bipartite:
In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
In[3]:=
Click for copyable input
Out[3]=
 
A WheelGraph is not a bipartite graph:
In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
BipartiteGraphQ gives False for anything that is not a bipartite graph:
Test large graphs:
A bipartite graph has no self-loops:
Any tree is bipartite:
A PathGraph with different start and end vertices is bipartite:
Any planar graph whose faces all consist of an even number of edges is bipartite:
A CycleGraph with an even number of vertices is bipartite:
A CompleteGraph is bipartite:
A TuranGraph is bipartite:
A graph is bipartite iff it has no odd cycle:
BipartiteGraphQ gives False for non-explicit graphs:
New in 8