Re: [Neo4j] how many relationships?

2011-07-23 Thread Michael Hunger
An internal implementation would be probably faster. If timing is that critical for you, you can have a look in EmbeddedGraphDbImpl.getAllNodes() and implement a similar solution for relationships. Cheers Michael Am 23.07.2011 um 04:20 schrieb John cyuczieekc: Hey Jim, I am sort of glad

Re: [Neo4j] how many relationships?

2011-07-23 Thread John cyuczieekc
Hey Michael, I took a very quick look, I think understand it, looks like it attempts to get nodes by id starting from 0 until highest possible ID. public synchronized boolean hasNext() { while ( currentNode == null currentNodeId = highId ) { try

Re: [Neo4j] how many relationships?

2011-07-23 Thread Michael Hunger
Right, there could be even a faster ways but they would need a few additional methods in NodeManager :) Cheers Michael Am 23.07.2011 um 15:30 schrieb John cyuczieekc: Hey Michael, I took a very quick look, I think understand it, looks like it attempts to get nodes by id starting from 0

Re: [Neo4j] how many relationships?

2011-07-22 Thread cyuczi eekc
thanks for that, I only had embedded-examples changed, but it looks like I was doing the git pull wrong, that is I was using `git fetch from upstream` instead of `git pull`... I actually never had to use this before :) I was only ever committing with git (used svn/mercurial before though) For

Re: [Neo4j] how many relationships?

2011-07-22 Thread Michael Hunger
you would have never gotten the update git pull does a fetch and merge please read a quick intro to git there are many on the internets mobile mail please excuse brevity and typos Am 22.07.2011 um 08:10 schrieb cyuczi eekc cyuczie...@gmail.com: thanks for that, I only had embedded-examples

Re: [Neo4j] how many relationships?

2011-07-22 Thread John cyuczieekc
How would I go about getting all relationships in the entire database ? (with neo4j embedded) I see there is an db.getAllNodes() for nodes is there something similar for relationships? On Wed, Jul 20, 2011 at 7:13 PM, cyuczi eekc cyuczie...@gmail.com wrote: Is there a way to get the number of

Re: [Neo4j] how many relationships?

2011-07-22 Thread Michael Hunger
for (Node node : db.getAllNodes()) for (Relationship rel : node.getRelationships(Direction.OUTGOING)) { // your code here } Michael Am 22.07.2011 um 23:40 schrieb John cyuczieekc: How would I go about getting all relationships in the entire database ? (with neo4j embedded) I see there is

Re: [Neo4j] how many relationships?

2011-07-22 Thread John cyuczieekc
Though that is kind of telling me that relationships only exist in java as wrappers for an ordered tuple of nodes. I guess I was thinking that they were stored/accessed differently as unique objects(since they each have an id)... maybe they are but neo4j isn't exposing a method for parsing

Re: [Neo4j] how many relationships?

2011-07-22 Thread Jim Webber
Hi John, Relationships are stored in a different store than nodes. This enables Neo4j to manage lifecycle events (like caching) for nodes and relationships separately. Neo4j really is a graph DB, not a tripple store masquerading as a graph DB. Nonetheless, that code Michael sent still works

Re: [Neo4j] how many relationships?

2011-07-22 Thread John cyuczieekc
Hey Jim, I am sort of glad to hear that, maybe in the future I could see a method like getAllRelationships(), or not, np :) Yes, using Michael's code works, but ... total relations count=100,011 timedelta=3,075,897,991 ns it kind of takes 3 seconds (when not cached) to count 100k relationships

Re: [Neo4j] how many relationships?

2011-07-21 Thread Michael Hunger
We're already on it. Looking through the causes for that issue and will keep you and everyone else informed. Michael Am 21.07.2011 um 06:52 schrieb cyuczi eekc: about this, should I create an issue? ___ Neo4j mailing list User@lists.neo4j.org

Re: [Neo4j] how many relationships?

2011-07-21 Thread cyuczi eekc
Hey, btw, the issue was fixed: https://trac.neo4j.org/ticket/356#comment:1 However, github didn't yet sync the git-readonly (ie. git:// github.com/neo4j/community.git ) and looks like I am 3-4 days back, since my HEAD is at: Minor fix to the cypher/identifiers section.

Re: [Neo4j] how many relationships?

2011-07-21 Thread Michael Hunger
github has no separate repo for tge readonly url most probably your git pull failed due to local changes git stash them or use git pull --rebase Michael mobile mail please excuse brevity and typos Am 22.07.2011 um 04:32 schrieb cyuczi eekc cyuczie...@gmail.com: Hey, btw, the issue was

[Neo4j] how many relationships?

2011-07-20 Thread cyuczi eekc
Is there a way to get the number of relationships without having to iterate through (and count++) them? ie. rels=firstNode.getRelationships(); rels.size(); //doesn't actually exist ___ Neo4j mailing list User@lists.neo4j.org

Re: [Neo4j] how many relationships?

2011-07-20 Thread Jim Webber
Hi, Responses from calling the Neo4j APIs are typically lazy, for performance reasons. So there's no way of eagerly counting the number of relationships unless you force eager evaluation as you've suggested below. Jim On 20 Jul 2011, at 11:13, cyuczi eekc wrote: Is there a way to get the

Re: [Neo4j] how many relationships?

2011-07-20 Thread cyuczi eekc
I guess I was hoping it(size/count) was cached in the database or the underlaying database would provide this somehow, ie. in berkeleydb (java edition) there's a cursor.count() I could use (though I don't know how they did it implementation-wise) Thanks! I needed to know that. On Wed, Jul 20,

Re: [Neo4j] how many relationships?

2011-07-20 Thread Michael Hunger
Caching that result would require synchronizing it with every change using up memory and performance (at every change) for something that can be computed So far it has not been worth the effort. If you really need that value very often you could write a small TransactionEventHandler that keeps

Re: [Neo4j] how many relationships?

2011-07-20 Thread cyuczi eekc
Trying to count the relationships the normal way I find that oddly, I cannot see more than 100+x relationships, where x is the maximum number of relations ever added within a transaction. For example, if I add 91 relationships in a transation, and I count them, I have 91. I run the program again

Re: [Neo4j] how many relationships?

2011-07-20 Thread cyuczi eekc
I should probably mention that I am using neo4j community (embedded) latest sources up to date from github On Thu, Jul 21, 2011 at 4:59 AM, cyuczi eekc cyuczie...@gmail.com wrote: Trying to count the relationships the normal way I find that oddly, I cannot see more than 100+x relationships,

Re: [Neo4j] how many relationships?

2011-07-20 Thread cyuczi eekc
Ok there, I found out something new, if I do the count outside of the transaction (ie. after tx.finish() ) then it works right, ie. in a different example: Node `one` has 100,100 out rels, time=7,954,653,001 tx.finish() time=1,525,669,261 Node `one` has 1,200,546 out rels And as long as I create

Re: [Neo4j] how many relationships?

2011-07-20 Thread cyuczi eekc
about this, should I create an issue? On Thu, Jul 21, 2011 at 5:15 AM, cyuczi eekc cyuczie...@gmail.com wrote: Ok there, I found out something new, if I do the count outside of the transaction (ie. after tx.finish() ) then it works right, ie. in a different example: Node `one` has 100,100