Re: [Neo4j] Function to check whether two nodes are connected?

2011-10-28 Thread Mattias Persson
Just a heads up here: if (r.getType().equals(rel.getType())) isn't accurate. If you read the javadocs you can see that you cannot compare RelationshipType instances, but rather their names or use the short-hand method on Relationship: if (r.isType(rel.getType())) 2011/10/27 Bruno Paiva

[Neo4j] Function to check whether two nodes are connected?

2011-10-27 Thread Bruno Paiva Lima da Silva
Hello there! First of all, thanks for the help in all my previous questions, all the answers have been helping me to use Neo4j with success. I have a very simple question, but I haven't found the answer yet... I'd like to have a function, which signature would be more or less like this:

Re: [Neo4j] Function to check whether two nodes are connected?

2011-10-27 Thread Peter Neubauer
Bruno, There is no such function low level, but toy can use a Shortest path algo to check this. What is the maximum length for a path between the nodes? On Oct 27, 2011 6:14 PM, Bruno Paiva Lima da Silva bplsi...@gmail.com wrote: Hello there! First of all, thanks for the help in all my previous

Re: [Neo4j] Function to check whether two nodes are connected?

2011-10-27 Thread Bruno Paiva Lima da Silva
Easy: just one. For now, I've written this, but I'm still not sure it is the simplest way to write it public boolean areConnected(Node n1,Node n2,Relationship rel,Direction dir) throws Exception { IterableRelationship relationships = n1.getRelationships(dir); for

Re: [Neo4j] Function to check whether two nodes are connected?

2011-10-27 Thread Niels Hoogeveen
2011 18:39:01 +0200 From: bplsi...@gmail.com To: user@lists.neo4j.org Subject: Re: [Neo4j] Function to check whether two nodes are connected? Easy: just one. For now, I've written this, but I'm still not sure it is the simplest way to write it public boolean areConnected(Node n1

Re: [Neo4j] Function to check whether two nodes are connected?

2011-10-27 Thread Niels Hoogeveen
...@hotmail.com To: user@lists.neo4j.org Date: Thu, 27 Oct 2011 19:05:16 +0200 Subject: Re: [Neo4j] Function to check whether two nodes are connected? There is one caveat to this method, you'd have to know which node is most densely connected. Suppose one of the nodes has 100,000 relationships

Re: [Neo4j] Function to check whether two nodes are connected?

2011-10-27 Thread Peter Neubauer
().equals(n2) return true; else if (rel2.getEndNode().equals(n1)) return true; } return false; } From: pd_aficion...@hotmail.com To: user@lists.neo4j.org Date: Thu, 27 Oct 2011 19:05:16 +0200 Subject: Re: [Neo4j] Function to check whether two nodes are connected

Re: [Neo4j] Function to check whether two nodes are connected?

2011-10-27 Thread Niels Hoogeveen
You know me and my obsession for densely connected nodes :-) Date: Thu, 27 Oct 2011 17:37:07 + From: peter.neuba...@neotechnology.com To: user@lists.neo4j.org Subject: Re: [Neo4j] Function to check whether two nodes are connected? Good catch Niels, thanks - my brain is in jet lag mode