# Topological Sorting

Posted: 7 Dec, 2020

Difficulty: Moderate

#### Given a DAG(direct acyclic graph), print Topological Sorting of a given graph

##### Input Format:

```
The first line of input contains an integer T, the number of test cases.
The first line of each test case contains two single space-separated integers V, and E.
From the second line onwards of each test case, the next 'E' lines will denote the edges of the graph where every edge is defined by two single space-separated integers 'a' and 'b', which signifies an edge from vertex 'a’ to vertex 'b'.
```

##### Output Format :

```
For each test, case output will be "Correct" if the topological sort is done correctly else it will be "Incorrect".
```

##### Constraints:

```
1 <= T <= 10
1 <= V <= 1000
0 <= E <= 3000
0 <= U, V <= V-1
Time Limit: 1sec
```

Working on approaches!

Meanwhile, please head to Code Editor and try the problem there.

Meanwhile, please head to Code Editor and try the problem there.

SIMILAR PROBLEMS

# Get DFS Path

Posted: 22 Jul, 2021

Difficulty: Easy

# Get Path using BFS

Posted: 22 Jul, 2021

Difficulty: Easy

# Bellman Ford

Posted: 23 Jul, 2021

Difficulty: Moderate

# Floyd Warshall

Posted: 23 Jul, 2021

Difficulty: Moderate

# Collect Maximum Coins in Matrix

Posted: 29 Oct, 2021

Difficulty: Moderate