Bridge Edge in Graph
Submissions: 1708   Accuracy:

23.22%

  Difficulty: Medium   Marks: 4

Given an undirected graph and an edge, the task is to find if the given edge is a bridge in graph, i.e., removing the edge disconnects the graph.
Input:

The first line of the input contains an integer 'T' denoting the number of test cases. Then 'T' test cases follow. Each test case consists of two lines. 
Description of  test cases is as follows:
The First line of each test case contains two integers 'N' and 'M'  which denotes the no of vertices and no of edges respectively.
The Second line of each test case contains 'M'  space separated pairs u and v denoting that there is a bidirectional  edge from u to v 

The third line contains two space seperated integers denoting the edge to be removed.
Output:

For each test case ouput a single line 1 or 0, 1 if edge is a Bridge edge or not. 
Constraints:

1<=T<=50

1<=N,M<=100
Example:

Input:

2
4 3
0 1 1 2 2 3
1 2
5 5
1 2 2 0 1 0 3 4 3 0
2 0

Ouput:

1
0

Note:The Input/Ouput format and Example given are used for system's internal purpose, and should be used by a user for Expected Output only. As it is a function problem, hence a user should not read any input from stdin/console. The task is to complete the function specified, and not to write the full code.

** For More Input/Output Examples Use 'Expected Output' option **

Author: harshitsidhwa


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.