# Graph find all vertices that are part of a cycle

I was wondering how I can find all the vertices in a graph that are part of a cycle. To determine this for one vertex, I could just start a DFS from that vertex, but this seems unefficient to me when I want to know for all vertices.

• @Sagnik Finding all the vertices that are on cycles is absolutely not NP-complete, unless P$\,=\,$NP. The asker gives the obvious polynomial-time algorithm. – David Richerby Jun 7 '18 at 11:23