Respected, here is the case which I want to count total number of nodes and dragging only some level (in between) of nodes from total.
The sample code looks like this: public Traverser testCase(Node node, int limitFrom) { TravesalDescription td = null; try{ td = Traversal.description(). breadthFirst().relationships(relType.Knows, Direction.BOTH) .uniqueness(Uniqueness.RELATIONSHIP_GLOBAL) .evaluator(new Evaluator() { int max = 0; public Evaluation evaluate(Path path) { Relationship lastRelation = path.lastRelationship(); if(lastRelation == null){ return Evaluation.EXCLUDE_AND_CONTINUE; } if(max >= limitFrom){ max++; return Evaluation.INCLUDE_AND_CONTINUE; }else { max++; return Evaluation.EXCLUDE_AND_CONTINUE; } } }); }catch(Exception ex){ ex.printStrackTrace(); } return td.traverse(node) } This traverse function returns the certain limited number of nodes traversed in the total number of nodes (I am not sure with the code & I just wrote code to give an idea). So my question is before passing the value to limitFrom, we need to know the total number of nodes(If count is in Thousands or Lakhs). So is their any direct method to find the total number of nodes traversed by the traverse function itself in the traverse function. For this I added a max variable in the evaluator class function (May be it not works, I am not sure). So if you have any ideas or if I done any mistake kindly let me know. Regards, Bhargav. On Sun, Apr 17, 2011 at 11:29 PM, Peter Neubauer < peter.neuba...@neotechnology.com> wrote: > Bhargav, > I'm not sure I am following you. Could you maybe write some pseudo > code to highlight the case? > > Cheers, > > /peter neubauer > > GTalk: neubauer.peter > Skype peter.neubauer > Phone +46 704 106975 > LinkedIn http://www.linkedin.com/in/neubauer > Twitter http://twitter.com/peterneubauer > > http://www.neo4j.org - Your high performance graph database. > http://startupbootcamp.org/ - Ă–resund - Innovation happens HERE. > http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party. > > > > On Wed, Apr 13, 2011 at 7:18 PM, bhargav gunda <bhargav....@gmail.com> > wrote: > > Yeah I know that but I want it in the traverse function itself. Based on > the > > result again I want to do one more function. So i am trying to find in > the > > traverse function. > > > > Thanks & Regards, > > G. > > > > On Wed, Apr 13, 2011 at 3:47 PM, Peter Neubauer < > neubauer.pe...@gmail.com>wrote: > > > >> Of course, > >> You can have a count outside your traversal description that for > instance > >> and Evaluator is updating since it is called for all traversed nodes. > This > >> is not thread safe but I think it will give you the data you want? > >> > >> Sent from my phone. > >> On Apr 13, 2011 12:32 PM, "Stephan Hagemann" < > >> stephan.hagem...@googlemail.com> wrote: > >> > Hi Gunda, > >> > > >> > I believe you are asking fir the same thing I asked for a couple of > days > >> > ago. Check this thread: > >> > > >> > http://lists.neo4j.org/pipermail/user/2011-April/007932.html > >> > > >> > As the discussion shows, this feature is currently not available but > >> > probably interesting in a lot of settings. At least for you and me ;) > >> > > >> > Regards, > >> > Stephan > >> > > >> > > >> > On Wed, Apr 13, 2011 at 11:23, bhargav gunda <bhargav....@gmail.com> > >> wrote: > >> > > >> >> Respected, > >> >> > >> >> I would to know that is there any method to count the number of nodes > >> and > >> >> relationships traversed by the traversal framework. > >> >> Like path.length() ---> which gives the depth of the tree. So as like > >> that > >> >> method is there any direct one? > >> >> > >> >> For example, > >> >> > >> >> If a tree consist of several nodes and several relations. And I want > to > >> >> traverse from a particular node to the end of the tree and the result > >> has > >> >> only contains certain period of nodes like if the tree traverse 1000 > >> nodes > >> >> and 10000 relationships from a particular node and I want only the > >> result > >> >> which contains from node 35 to node 70. > >> >> So is there any direct method to get the count list of nodes and > >> >> relationships. > >> >> > >> >> Thanks & Regards, > >> >> G. > >> >> _______________________________________________ > >> >> 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 > >> _______________________________________________ > >> 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 > > > _______________________________________________ > 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