Detecting a cycle between two vertices in a directed graph

1.4k Views Asked by At

I want to make an algorithm that will detect if there exists a path with a cycle between two vertices $(u,v)$ . Now, I know that to detect a cycle in a graph, we check for any back edges. If one exists, we have a cycle. But I need to find if any path between two specific vertices has a cycle. What is the best way to do this?