Help : Bridges- Graph

This is my code to identify Bridges in graph.
Link for Code: https://pastebin.com/MEgERsVf
This code is failing for testcase:

4 6

1 3
1 4
2 1
3 2
4 2
4 3

This is the graph of 4 nodes where every node is connected to every other node with only single edge.
When , I changed my source vertex from 1 to 2 ,it worked correctly.
but for source vertex 1 , it is showing 3—>1 as bridge which is incorrect.

Please help.
@l_returns @galencolin

at line 38 change this low[u]=min(low[child],in_time[u]); to low[u]=min(low[child],low[u]); . It will solve the problem.

1 Like

Thank you for helping , It was actually low[u] = min( in_time[child], low[u] );

1 Like