其他分享
首页 > 其他分享> > ALG 3-4: Testing Bipartiteness - An Application of BFS

ALG 3-4: Testing Bipartiteness - An Application of BFS

作者:互联网

Bipartite Graphs

Def. An undirected graph G = (V, E) is bipartiteif the nodes can be colored red or blue such that every edge has one red and one blue end.

(定义: 无向图G = (V, E)是双偏图,如果节点可以用红色或蓝色表示,使得每条边都有一个红色和一个蓝色端)

Applications.

 

 

 

Testing Bipartiteness

Testing bipartiteness. Given a graph G, is it bipartite? (给定一个图G,它是二部图吗?)

 

 

An Obstruction to Bipartiteness

 

Lemma. If a graph G is bipartite, it cannot contain an odd length cycle.

(引理: 如果图G是二部图,它不可能包含奇长度环)

Proof. Not possible to 2-color the odd cycle, let alone G.

 

 

Bipartite Graphs

Lemma. Let G be a connected graph, and let L0, …, Lk be the layers produced by BFS starting at node s. Exactly one of the following holds.

(引理:设G为连通图,L0,…,Lk为从节点s开始的BFS生成的层. 则至少有下面的一个是正确的)

(i) No edge of G joins two nodes of the same layer, and G is bipartite. (G的边从不连接同一层的两个节点,且G是二部图)

 

 

(ii) An edge of G joins two nodes of the same layer, and G contains anodd-length cycle (and hence is not bipartite).

     (G其中的一条边连接了同一层的两个节点,并且G包含奇数长度的循环(因此不是二部图))

 

Proof. (i)

 

 

 

 

 

 Proof. (ii)

 

 

 

 

 

 

标签:Bipartiteness,blue,ALG,Testing,节点,edge,graph,nodes,bipartite
来源: https://www.cnblogs.com/JasperZhao/p/13975618.html