Checking if a node is visited in a graph or not.