I was going through this link and I have some doubts.

- Why is topological sorting used here? What will be the problem if we don’t use it?

- In function longestPath(), topological sort is used on all vertices. Why is that?

```
for (int i = 0; i < V; i++)
if (visited* == false)
topologicalSortUtil(i, visited, Stack);
```

For the graph given in the site, calling it once for the source works too.

```
topologicalSortUtil(s, visited, Stack);
```

3)Can this be used for finding shortest path in the graph too? I think it should be possible if we swap the less than sign to greater than sign.

4)If it can be used to find shortest path, then is it faster or dijkstras?

Thanks in advance