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

Автор vatsal, история, 10 лет назад, По-английски

What algorithm should I use to find the number of rooted trees in an undirected graph? This problem requires it

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

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +5 Проголосовать: не нравится

No, it doesn't. You just need to check if the graph has only one cycle and is connected. It can be done with a simple DFS or with DSU. See here -> 22406598