Блог пользователя -0.69

Автор -0.69, история, 15 месяцев назад, По-английски

Image Example?Hey I was wondering If I have a graph that contains cycles. How can I break it into all possible Trees?? (Assuming the no. of vertices are very less?)

  • Проголосовать: нравится
  • -9
  • Проголосовать: не нравится

»
15 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

the simplest way is probably to just try all $$$n!$$$ paths, since in the worst case, there will be about $$$n!$$$ subtrees anyways.

However, if you want it to be fast, this is what i found: http://www.hariharan-ramesh.com/papers/spantree1.pdf and https://cs.ou.edu/~thulasi/Algorithm/Complexity%20of%20Computation%20of%20a%20Spanning%20Tree%20Enumeration%20Algorithm.pdf

»
15 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

to convert it to the tree you need to cancel cycles: to cancel a cycle you should at least delete one edge so you should make it independently for every cycle and then combine it, I think it needs very small constraints or a small number of cycles I see an idea like this Here

»
15 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Maintain a visited array and add the edges as they're given in the input. If both nodes in a given edge are visited, discard the edge.