Sounds like a pretty easy SQL query, though. ;-)


   Actually the "random sampling" aspect definitely throws a complication
   into the requirements.  I can't even picture how to achieve that in Neo
   without first obtain some (large) set of nodes and using a randomizer
   to select from the set/array.  Iterating on getAllNodes and stopping
   after "n" matches wouldn't meet the "random" requirement.



   It might be helpful to better understand the application/domain
   requirements and maybe there are alternative ways to achieve the same
   results.

   -------- Original Message --------
   Subject: Re: [Neo4j] Querying for nodes that have no relationhip to a
   specfic node
   From: Vitor De Mario <[1][email protected]>
   Date: Tue, July 27, 2010 8:24 pm
   To: Neo4j user discussions <[2][email protected]>
   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
   <[3][email protected]>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: [4][email protected]
   > > To: [5][email protected]
   > > 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
   > > [6][email protected]
   > > [7]https://lists.neo4j.org/mailman/listinfo/user
   >
   > _________________________________________________________________
   > New Windows 7: Simplify what you do everyday. Find the right PC for
   you.
   > [8]http://windows.microsoft.com/shop
   > _______________________________________________
   > Neo4j mailing list
   > [9][email protected]
   > [10]https://lists.neo4j.org/mailman/listinfo/user
   >
   _______________________________________________
   Neo4j mailing list
   [11][email protected]
   [12]https://lists.neo4j.org/mailman/listinfo/user

References

   1. mailto://[email protected]/
   2. mailto://[email protected]/
   3. mailto://[email protected]/
   4. mailto://[email protected]/
   5. mailto://[email protected]/
   6. mailto://[email protected]/
   7. https://lists.neo4j.org/mailman/listinfo/user
   8. http://windows.microsoft.com/shop
   9. mailto://[email protected]/
  10. https://lists.neo4j.org/mailman/listinfo/user
  11. mailto://[email protected]/
  12. https://lists.neo4j.org/mailman/listinfo/user
_______________________________________________
Neo4j mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to