LinkedList<Node> nodesList = new LinkedList<Node>();
LinkedList<Relationship> relationshipsList = new LinkedList<Relationship>();
TraversalBranch stepper = branch;
while ( stepper != null )
{
nodesList.addFirst( stepper.node() );
Relationship relationship = stepper.relationship();
if (relationship != null)
{
relationshipsList.addFirst( relationship );
}