A few questions/thoughts: - Do you have any expectation/prediction of the number of nodes satisfying the query? - Do you care about *all* results or only the top "n" (I ask this because in most cases, a dataset of a zillion ordered records is of little value - often only the "edges" have meaningful content)
If the answer to the first question is < a couple million or so, I would probably sort in memory. If the answer to the second question is "yes", then the problem because very easy, in that you can maintain a sorted list of the top "n" during the traversal process fairly easily. -----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:17 AM To: Neo4j user discussions Subject: Re: [Neo4j] Getting sorted results from a traversal Well in fact, I expect to order the resulting set of nodes by a property on that end nodes. But This class cold also help on some use cases I think. / purbon On 15 July 2011 16:43, Niels Hoogeveen <pd_aficion...@hotmail.com> wrote: > > Hi,You basically have two options. If your result set is not too big, you > can sort it in memory, though that approach may consume too much memory if > the result set is very large. In that case you can use SortedTree (see: > https://github.com/peterneubauer/graph-collections/tree/master/src/main/java/org/neo4j/collections/sortedtree). > This allows you to layout the relationships you want to traverse in sorted > order. > Niels > > Date: Fri, 15 Jul 2011 16:06:44 +0200 > > From: p...@moviepilot.com > > To: user@lists.neo4j.org > > Subject: [Neo4j] Getting sorted results from a traversal > > > > 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 _______________________________________________ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user