I was trying to write code for detecting a cycle in a directed graph and if there is no cycle then return a topological order of the same.
While I was searching for it I came across different techniques like DFS and topological sorting to detect cycle in a directed graph.
Is there any difference between these two?