dfs function that takes a node and its discoveryRank.rank array to keep track of the rank of nodes.dfs function, assign the discoveryRank to the node if it has not been visited.recursiveRank.recursiveRank is less than discoveryRank, discard the edge as it is part of a cycle.dfs starting from node 0 with rank 0.