Traversal of Nodes

I need to traverse already created ORientDB nodes in java. I have the root node as an object of OResultSet, but now I want the object of the neighbour of my root node of type OResultSet. I can get next() but of OResult only.
I am trying to implement Depth First Search algo. to traverse through all the nodes. Eventually, I plan to convert this data to a JSON file.
Thank you for your help!

Yash Ratan

Hi @yashratan97

Not sure I got the point, but from OResult you can obtain a live Vertex instance (if the result is actually a vertex) using result.getVertex()