freaky_ashish's blog

By freaky_ashish, history, 6 weeks ago, In English

Actually i need some solutions on... 1.How to print the cycles in a graph. 2.How to print different cycles with given no. of edges (the cycle must have that no. of edge).

 
 
 
 
  • Vote: I like it
  • 0
  • Vote: I do not like it

»
6 weeks ago, # |
Rev. 3   Vote: I like it 0 Vote: I do not like it

I don't think 2 can be done easily. Set no. of edges to |V| and you have an NP hard problem. Of course, if your problem has special constraints, it might still be possible to work out a reasonable solution.

With the above, we can also say that 1 cannot be done easily.

Of course, if you don't care about runtime, you can just use backtracking to achieve your goal.

  • »
    »
    5 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    can you provide solution or link for that ... it will help me to understand

»
6 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

cycles can also be found using DSU maybe there is a workaround for the same. I am not sure.