If this is feasible in Alberto's application, you have to consider that you will be creating a complete graph, and for such a graph with n nodes, you'll have O(n^2) relationships. This can grow really, really fast.
Besides, it would turn the insertion of a new node into a potentially slow operation, as you would need to assign the "absence" relationship to every existing node. []'s Vitor On Tue, Jul 27, 2010 at 8:51 PM, Niels Hoogeveen <pd_aficion...@hotmail.com>wrote: > > Is it possible to encode the absence of a relationship with a relationship > in your application? > > > Date: Tue, 27 Jul 2010 18:52:10 +0100 > > From: alberto.perd...@gmail.com > > To: user@lists.neo4j.org > > Subject: [Neo4j] Querying for nodes that have no relationhip to a specfic > node > > > > Hi, > > > > I'm considering using neo4j for a current project I'm working on. > > > > I need to do the following periodically (e.g. daily): > > * step 1: for every node, let's call it A, I need to pick n other > > nodes randomly that fullfill certain attributes and have no > > relationship to A. > > * step2: For each of those nodes and A, I calculate some value and > > store it within the relationship. > > > > Regarding step 1, from what I've read, it seems there is no way of > > querying nodes that have no relationship to a specific node. Of course > > I could query all the nodes of the database that fullfill certain > > attributes, store them within a variable, then query all relationhips > > for node A and then substract those nodes from the array variable. But > > I think this approach won't work very well as the amount and density > > of relationships gets higher... > > > > Do you have any recommendations? Can you suggest another strategy? > > Perhaps there is a way of making that query? > > > > Any help of appreciated. > > Alberto. > > _______________________________________________ > > Neo4j mailing list > > User@lists.neo4j.org > > https://lists.neo4j.org/mailman/listinfo/user > > _________________________________________________________________ > New Windows 7: Simplify what you do everyday. Find the right PC for you. > http://windows.microsoft.com/shop > _______________________________________________ > 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