Implemented classify() method using DFS to find all the nodes that are
connected by a path with a specific node