How to change OTraverse's visiting order?

34 views
Skip to first unread message

Lucas Lira Gomes

unread,
Sep 18, 2015, 9:31:30 AM9/18/15
to OrientDB
Hi all,

I'm using the OTraverse class, in the Java API, to traverse some links that are stored in a hierarchy of nodes with maps containing RIDs. For such, I employ the depth-first algorithm mode, but I did not find a way to determine the order of the traversal. Right now, those aforementioned maps use an int, as keys, and the algorithm is visiting the RIDs with the smallest keys first, but for my use case I want exactly the contrary. The algorithm has to be depth-first, but the RIDs with the biggest keys must be visited first. Anybody know how to solve that in the Java API?

Regards, Lucas Lira Gomes.

alessand...@gmail.com

unread,
Sep 21, 2015, 5:46:05 AM9/21/15
to OrientDB
Hi Luca,
try using the attached code and let me know if it is worthwhile.

Kind regards,
Alessandro
Traverse.java
Main.java

Lucas Lira Gomes

unread,
Sep 21, 2015, 10:17:26 AM9/21/15
to orient-...@googlegroups.com
Hi Alessandro,

thank you, but I was aware how to implement it by hand. My question was if it was possible to use the OTraverse class, which is a quite elegant interface, to do the traversal in the opposite order it usually do. And if so, how?

Regards, Lucas Lira Gomes.

----------------------------------------------------------------------------------
Lucas Lira Gomes (x8lucas8x)
Linux User #533002
Tel.: +55 (81) 99596-7816

http://www.x8lucas8x.com/

--

---
You received this message because you are subscribed to a topic in the Google Groups "OrientDB" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/orient-database/Vf52Z-eAQo4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to orient-databa...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages