The Art Gallery Guardian

Even cycle in a simple graph


Problem1

is a simple graph, decide if there exist a cycle of even length in .

The problem comes from 2014 Spring UIUC Theory Qualify Exam.

1 Characterizations

Let denote the local edge connectivity of vertices and . It’s the same as the largest number of edge disjoint paths connecting and . . Similarly, is defined as local vertex connectivity, and

Theorem2

If for some , then there exist an even cycle.

Proof

There are 3 vertex disjoint paths from to , thus it contains cycle , and . One of them will have even length.

Theorem3

If , then .

Proof

If , we consider the 3 edge paths between . Let them be . Notice if none of them intersect at a vertex, .

If intersects and has their first intersection at . Let and be the paths following from to and to , and the paths following from to . is a cycle that contains and . because there is an additional edge disjoint path from to .

So now we can consider , where and is in some cycle . Consider another path from to that is edge disjoint from the cycle. Let be the first vertex where intersects . Clearly, .

It should be easy to show that

Theorem4

If , then all cycles in the graph are edge disjoint.

2 A complicated yet obvious algorithm

  1. Compute if , if so, return true.
  2. Compute if there is an even cycle in linear time.

We first sparsify the graph with Nagamochi and Ibaraki’s linear time algorithm that preserves the edge connectivity up to . After spending time, the graph has at most edges. We want to find a global maximum min-cut in the resulting graph. Either -min-cut is the global maximum min-cut, or are in the same component of the global maximum min-cut. One can modify Stoer-Wagner algorithm to find in time. Since our graph is unweighted we can do it better in time.

Another approach is to show the graph cannot contain a diamond graph as a minor and use any general graph minor recognition algorithm. The fastest I know is the one from the original Robertson–Seymour paper. There are some discussion on cstheory on what is know about this algorithm.

However we can do it better, because we can easily check graphs without a diamond as a minor has treewidth two. So we can first check if the graph have a fixed treewidth in linear time[1]. Next, we can then apply a linear time minor testing algorithm on graphs with bounded branch width(which is implied by bounded treewidth)[2].

The second step is computationally easy. Do a DFS, whenever we find a cycle, check if the cycle is even, delete all those edges, and keep going. The number of steps we take is at most time. In fact, we don’t really need to delete the edges once we find a cycle, as we know they will never get used by another cycle.

3 A much simpler algorithm

Our algorithm above is pretty general and uses some heavy machinery. That’s the kind of solution I would give during a qualify exam due to time constraints(well, always use the most powerful technique possible).

The theorems we proved implies one nice corollary

Corollary5

If a graph has no even cycles, then all cycles in the graph are edge disjoint.

This kind of graph has a name, a cactus graph. It is so special we can recognize it in linear time. A graph is a cactus if once we build a DFS tree, every vertex has at most one back edge.

This implies a extremely simple algorithm

  1. Run a DFS to build a DFS tree. Let be the depth of a vertex in the tree.
  2. Assume there is a back edge between and , check if there is any back edge end at some node in the unique path from to .
  3. For every vertex , if it has a back edge to some vertex , then check if is odd. If it is, return true.
  4. Return false.

References

[1]
H. Bodlaender, A linear-time algorithm for finding tree-decompositions of small treewidth, SIAM Journal on Computing. 25 (1996) 1305–1317 10.1137/S0097539793251219.
[2]
I. Adler, F. Dorn, FedorV. Fomin, I. Sau, DimitriosM. Thilikos, Faster parameterized algorithms for minor containment, in: H. Kaplan (Ed.), Algorithm Theory - SWAT 2010, Springer Berlin Heidelberg, 2010: pp. 322–333 10.1007/978-3-642-13731-0_31.
Posted by Chao Xu on .
Tags: algorithm.