[I'm a newbie] Need help with a undirected graph problem!

Правка en3, от ARcados, 2018-06-02 02:39:22

Hi, i'm have problems whit find cicle in D. Subway problem. initially I thought that by implementing tarjan algorithm I could find the cycle (I tried it and I can't imagine it in an unmanaged graph), but maybe it would be easier to go through it with bfs and store the nodes that I am visiting in a set if they are not in the set . If it means that the nodes of the set are the cycle that I am looking for. Is this correct?. Is there a more efficient way and how can I implement it? Thank you

Теги #graph, tarjan, bfs, #graphs

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en5 Английский ARcados 2018-06-02 03:48:59 0 (published)
en4 Английский ARcados 2018-06-02 03:45:51 35 Tiny change: ') problem.\ninitially I' -> ') problem. I have to find a cicle. Initially I' (saved to drafts)
en3 Английский ARcados 2018-06-02 02:39:22 10 Tiny change: 'ng tarjan I could f' -> 'ng tarjan algorithm I could f'
en2 Английский ARcados 2018-06-02 02:35:48 8 Tiny change: 'lementing dijkstra I could f' -> 'lementing tarjan I could f'
en1 Английский ARcados 2018-06-02 02:28:11 593 Initial revision (published)