I have an undirected adjacency boost graph without weights. I need to find minimum cycles in the graph.
minimum cycle: c1[1 2 3 4 ]
, c2[2 3 6 5]
, ...
but for example: [1 2 5 6 3 4]
is NOT a minimum cycle
because it contains cycle c1
in it.
I went through different posts during my search, but eventually I end up with solutions to get the all cycles in a graph but not minimum cycles. From Finding all cycles in undirected graphs and Cycles in an Undirected Graph I understood the best way is doing a DFS
search and look for back_edges
. This thread gives some solutions with boost, but it gives all the cycles not the minimum cycle and it doesn't have implementation. Algorithm for finding minimal cycles in a graph discusses also how to get the minimum cycle but there is no solution for it.
I appreciate if someone has a workaround for this (better in boost graph library)?
Update: Minimum cycle here means in the set of vertices of a candidate cycle, there shouldn't be another direct connection between two vertices. For example in c3[1 2 5 6 7 4]
there is no backedge between vertices, so it is a minimum
. But in c4[1 2 3 6 7 4]
there is an edge between [3 4]
that can make a cycle [1 2 3 4]
, so we don't consider c4
as a minimum.