Given a connected, undirected graph, find maximum number of non overlapping cycles ?
Example:-
Here in the above example we can have 2 (maximum number) non overlapping cycles, 0-1-2 and 4-5-6.
Any idea of how to solve this problem efficiently ?
№ | Пользователь | Рейтинг |
---|---|---|
1 | tourist | 3993 |
2 | jiangly | 3743 |
3 | orzdevinwang | 3707 |
4 | Radewoosh | 3627 |
5 | jqdai0815 | 3620 |
6 | Benq | 3564 |
7 | Kevin114514 | 3443 |
8 | ksun48 | 3434 |
9 | Rewinding | 3397 |
10 | Um_nik | 3396 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 155 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
10 | nor | 152 |
Given a connected, undirected graph, find maximum number of non overlapping cycles ?
Example:-
Here in the above example we can have 2 (maximum number) non overlapping cycles, 0-1-2 and 4-5-6.
Any idea of how to solve this problem efficiently ?
Название |
---|
By overlapping cycles do you mean 2 cycles that share at least 1 edge? or share at least 1 vertex?
Surely, for a graph with 3N nodes, the best one can ever do is N 3-cycles. Checking whether this is possible is the same as partitioning the graph into N disjoint triangles. As stated here, this is NP-Complete.
What if the number of the nodes are not multiple of 3 ? I just showed n=6 as an example, n can be anything.
Well, you asked for a solution that works for all N. I've stated that there are some N (in particular, multiples of 3) for which the problem reduces to something which is known to be NP-complete, so the whole problem (in its full generality) can't be any easier than NP-complete.
Edit: For the record, if N = 1/2 (mod 3), consider a graph G with 1/2 isolated nodes and an arbitrary subgraph G' induced by the other N' = 0 (mod 3) nodes. Then the problem once again reduces to finding a triangle partition of G'.
Note that this G is not connected, this can be easily fixed by adding arbitrary edges from the isolated nodes to some nodes in G' such that the extra nodes now have degree 1.
Ok, thanks for the reply :)