[Neo] Checking whether a relationship exists between two nodes...

Raul Raja Martinez raulraja at gmail.com
Tue Feb 2 23:49:10 CET 2010

Same issue here.
Would be nice to have something like
node.hasRelationshipTo(node, relationship... relationships);

2010/2/2 Maria Giatsoglou <mgiatsog at csd.auth.gr>:
> Hello all
> I am creating a project that performs a number of benchmark tasks on Neo.
> One of the tests measures the required time for creating a relationship
> between two neo nodes A and B.
> However, before creating the relationship, it should firs be checked
> whether a relationship of the same type already exists
> between these two nodes. My current implementation calls the
> getRelationships() function
> for the A node and then iterates over the returned Iterable object
> checking whether a relationship's end node is equal to node B.  If  such
> a relationship does not exist, then the required relationship is created
> between nodes A and B.
> However, this technique seems to be very slow, with the creation of a
> relationship (including the check operation)  taking around 57msec to
> complete. Is there a faster way to implement this operation? I
> considered trying to modify the LuceneIndexService implementation in
> order to enable indexing
> relationships apart from nodes. Do you recommend such an approach for
> this problem?
> Many thanks in advance,
> Best regards,
> Maria Giatsoglou
> _______________________________________________
> Neo mailing list
> User at lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user

Raul Raja

More information about the User mailing list