I would think that the graph structure definitely matters, in that there may be optimizations that can be achieved via indexing/querying vs traversal and sorting (or a hybrid of the two) depending on the specifics.
-----Original Message----- From: user-boun...@lists.neo4j.org [mailto:user-boun...@lists.neo4j.org] On Behalf Of Pere Urbon Bayes Sent: Friday, July 15, 2011 11:14 AM To: Neo4j user discussions Subject: Re: [Neo4j] Getting sorted results from a traversal Well the graph structure is not relevant here, I think. The property I expect to be sorting is on the destination node, so I can do the traversal and then expect to run the sorting. Please, tell me how the data structure can help me to deal with that order, please? / purbon On 15 July 2011 17:10, David Montag <david.mon...@neotechnology.com> wrote: > Hi Pere, > > Can you elaborate on your graph structure? > > Thanks, > David > > On Fri, Jul 15, 2011 at 8:04 AM, Pere Urbon Bayes <p...@moviepilot.com > >wrote: > > > Well, this is great if I want to do all the math in memory, but I expect > to > > do the computation by the db. > > > > / purbon > > > > On 15 July 2011 16:10, Marko Rodriguez <okramma...@gmail.com> wrote: > > > > > Hi Pere, > > > > > > To sort you need to have all your results. > > > > > > Thus, in Gremlin (and hopefully you can do the mapping to the core > Neo4j > > > traverser framework), > > > > > > results = [] > > > g.v(1).out('friend').out('likes') >> results // what my friends like > > > results.sort{a,b -> a.name <=> b.name} // sort resultant vertices by > > name > > > > > > In short, once you have the result of your traversal, you can then > apply > > a > > > comparator to the Collection to sort it as you please --- its just Java > > > comparators. > > > > > > See ya, > > > Marko. > > > > > > http://markorodriguez.com > > > > > > On Jul 15, 2011, at 8:06 AM, Pere Urbon Bayes wrote: > > > > > > > HI! > > > > I am on the situation of having to traverse neo4j, and then expect > the > > > > resultset returned to be ordered in a certain order. I've been > > > researching a > > > > bit over the traversal API, but I did not find anything related to > > that. > > > I > > > > really will appreciate any tip on that!! > > > > > > > > BTW > I expect to be possible right?, as we have in relational the > > > ordering, > > > > or on redis, etc... > > > > > > > > /purbon > > > > > > > > -- > > > > Pere Urbon-Bayes > > > > moviepilot GmbH | Mehringdamm 33 | 10961 Berlin | Germany > > > > Telefon +49 30 616 512 -110 | Fax +49 30 616 512 -133 > > > > _______________________________________________ > > > > Neo4j mailing list > > > > User@lists.neo4j.org > > > > https://lists.neo4j.org/mailman/listinfo/user > > > > > > _______________________________________________ > > > Neo4j mailing list > > > User@lists.neo4j.org > > > https://lists.neo4j.org/mailman/listinfo/user > > > > > > > > > > > -- > > Pere Urbon-Bayes > > moviepilot GmbH | Mehringdamm 33 | 10961 Berlin | Germany > > Telefon +49 30 616 512 -110 | Fax +49 30 616 512 -133 > > _______________________________________________ > > Neo4j mailing list > > User@lists.neo4j.org > > https://lists.neo4j.org/mailman/listinfo/user > > > > > > -- > David Montag <david.mon...@neotechnology.com> > Neo Technology, www.neotechnology.com > Cell: 650.556.4411 > Skype: ddmontag > _______________________________________________ > Neo4j mailing list > User@lists.neo4j.org > https://lists.neo4j.org/mailman/listinfo/user > -- Pere Urbon-Bayes moviepilot GmbH | Mehringdamm 33 | 10961 Berlin | Germany Telefon +49 30 616 512 -110 | Fax +49 30 616 512 -133 _______________________________________________ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user _______________________________________________ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user