Professional Documents
Culture Documents
Given a directed graph, a source vertex ‘s’ and a destination vertex ‘d’, print the count of
all paths from given s to d.
Input Format
The first line of input contains the number of test cases, T. First line of every test case
consists of V and E denoting the number of vertices and edges in the graph G. Next E
lines consists of 2 space separated integers denoting the edge between vertices. Last
line of every test case consists of 2 space separated integers denoting the source
vertex ‘s’ and destination vertex ‘d’.
Constraints
1 ≤ T ≤ 100
1 ≤ V, E ≤ 100
Output Format
For each test case, print count of all paths from ‘s’ to ‘d’.
Sample Input:
1
46
01
02
03
20
21
13
23
Sample Output:
3