.breadthFirst()
.relationships(DynamicRelationshipType.withName("friends"))
.order(new BranchOrderingPolicy() {
@Override
public BranchSelector create(final TraversalBranch startBranch) {
return new BranchSelector(){
@Override
public TraversalBranch next() {
TraversalBranch branch=startBranch;
while (branch!=null) {
if (branch.depth()<branch.next().depth()) return branch;