Adobe interview question

Traverse a directed graph with cycle, without having to implement hashcode() or equals() in the node class.