문제

A bipartite graph is a graph whose vertices can be divided into two disjoint sets U and V such that every edge connects a vertex in U to one in V; that is, U and V are each independent sets. Equivalently, a bipartite graph is a graph that does not contain any odd-length cycles.

Can I also say that if in a graph G all cycles are even in length, then it is bipartite?

I thought of one graph of even length cycle and it turned out to be non-bipartite.

     1----------2
     |          |
     |          |
     |          |
     |          |
     3----------4
도움이 되었습니까?

해결책

If in a graph G all cycles are even in length, then it is bipartite.

Apply BFS algorithm to graph G. It divides vertices of G into layers. Set U consists of vertices from odd layers, V of vertices from even layers. Let's assume (by contradiction) that there exists edge e that connects some two vertices x, y from U. Let r be the root of tree determined by BFS algorithm. Then path from x to r, from r to y, and edge e are cycle of odd length - that's contradiction as graph G doesn't contain odd-length cycles. (same with set V).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top