Re: [Neo4j] Generating suggestions in a Neo4j db
Jim, Thanks for the valuable input... The use case I mentioned here (using only visited places) was a simplistic version of the real one, because, just as you said, I'd be getting large number of results in that case... I'd check out pattern matching and Cypher to ease me in my project... Neo4j team is truly awesome! You guys are always there to help... On 6/18/11, Jim Webber j...@neotechnology.com wrote: That's a great point. In Neo4j you can add properties to your relationships so that: Jim --VISITED (numberOfTimes: 20) -- Melbourne Then you can use the numberOfTimes property to determine whether or not you'd like to include the person/city in the recommendations you're making. In this case it seems I'm rather keen on Melbourne, so you might want to recommend me to other folks who visit Melbourne a lot. As for whether it's more efficient than other databases, I suspect it is in the general case since this is a graph operation which other kinds of stores will have to reify for themselves (e.g recursive joins, big map/reduce job, etc). The cost of these kind of operations in Neo4j tends to be very low. Jim On 18 Jun 2011, at 07:56, faja...@gmail.com wrote: Ah this discussion is interesting, I want to join and throw in sonme idea too. If a user can visit a place for multiple times. And if there are 100 user visit USA. So we should suggest top 10 only. Would traversing the graph be more efficient than normal database query? Sent from my BlackBerry® smartphone from Sinyal Bagus XL, Nyambung Teruuusss...! -Original Message- From: Aman aman.6...@gmail.com Sender: user-boun...@lists.neo4j.org Date: Sat, 18 Jun 2011 10:50:34 To: Neo4j user discussionsuser@lists.neo4j.org Reply-To: Neo4j user discussions user@lists.neo4j.org Subject: Re: [Neo4j] Generating suggestions in a Neo4j db Hi Jim, The way you mentioned, that will take care of these suggestions, thanks for the same. But here's a tougher problem If I have a database of 50k people, and I want to find friends based upon the places that those 50k people have visited (i.e. People who have visited same places as me should be suggested as friends to me), then how to to that... I've thought all that I could, but I always come up with something stupid... Any suggestions about this? On 6/18/11, Aman aman.6...@gmail.com wrote: Hi Jim, The way you mentioned, that will take care of these suggestions, thanks for the same. But here's a tougher problem If I have a database of 50k people, and I want to find friends based upon the places that those 50k people have visited (i.e. People who have visited same places as me should be suggested as friends to me), then how to to that... I've thought all that I could, but I always come up with something stupid... Any suggestions about this? On 6/18/11, Jim Webber j...@neotechnology.com wrote: Hi Aman, I'm puzzled. Why not Aman--HAS_VISITED--USA Jim--HAS_VISITED--India And if: Aman--FRIEND-OF--Jim Then you just need to traverse from Aman following outgoing FRIEND_OF relationships to all your friends, and then traverse out their outgoing HAS_VISITED relationships to find places your friends have been. The general idiom with Neo4j is use indexes the find your start node (e.g. the Aman node in the above) then traverse from there. Jim ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user -- Amandeep +91-9878483857 -- Amandeep +91-9878483857 ___ 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 ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user -- Amandeep +91-9878483857 ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] Generating suggestions in a Neo4j db
Jim, I was going through Cypher and a question came into my mind regarding pattern matching... How is pattern matching done in neo4j? I mean, how are nodes and relationships matched in case of large data-sets? On 6/18/11, Aman aman.6...@gmail.com wrote: Jim, Thanks for the valuable input... The use case I mentioned here (using only visited places) was a simplistic version of the real one, because, just as you said, I'd be getting large number of results in that case... I'd check out pattern matching and Cypher to ease me in my project... Neo4j team is truly awesome! You guys are always there to help... On 6/18/11, Jim Webber j...@neotechnology.com wrote: That's a great point. In Neo4j you can add properties to your relationships so that: Jim --VISITED (numberOfTimes: 20) -- Melbourne Then you can use the numberOfTimes property to determine whether or not you'd like to include the person/city in the recommendations you're making. In this case it seems I'm rather keen on Melbourne, so you might want to recommend me to other folks who visit Melbourne a lot. As for whether it's more efficient than other databases, I suspect it is in the general case since this is a graph operation which other kinds of stores will have to reify for themselves (e.g recursive joins, big map/reduce job, etc). The cost of these kind of operations in Neo4j tends to be very low. Jim On 18 Jun 2011, at 07:56, faja...@gmail.com wrote: Ah this discussion is interesting, I want to join and throw in sonme idea too. If a user can visit a place for multiple times. And if there are 100 user visit USA. So we should suggest top 10 only. Would traversing the graph be more efficient than normal database query? Sent from my BlackBerry® smartphone from Sinyal Bagus XL, Nyambung Teruuusss...! -Original Message- From: Aman aman.6...@gmail.com Sender: user-boun...@lists.neo4j.org Date: Sat, 18 Jun 2011 10:50:34 To: Neo4j user discussionsuser@lists.neo4j.org Reply-To: Neo4j user discussions user@lists.neo4j.org Subject: Re: [Neo4j] Generating suggestions in a Neo4j db Hi Jim, The way you mentioned, that will take care of these suggestions, thanks for the same. But here's a tougher problem If I have a database of 50k people, and I want to find friends based upon the places that those 50k people have visited (i.e. People who have visited same places as me should be suggested as friends to me), then how to to that... I've thought all that I could, but I always come up with something stupid... Any suggestions about this? On 6/18/11, Aman aman.6...@gmail.com wrote: Hi Jim, The way you mentioned, that will take care of these suggestions, thanks for the same. But here's a tougher problem If I have a database of 50k people, and I want to find friends based upon the places that those 50k people have visited (i.e. People who have visited same places as me should be suggested as friends to me), then how to to that... I've thought all that I could, but I always come up with something stupid... Any suggestions about this? On 6/18/11, Jim Webber j...@neotechnology.com wrote: Hi Aman, I'm puzzled. Why not Aman--HAS_VISITED--USA Jim--HAS_VISITED--India And if: Aman--FRIEND-OF--Jim Then you just need to traverse from Aman following outgoing FRIEND_OF relationships to all your friends, and then traverse out their outgoing HAS_VISITED relationships to find places your friends have been. The general idiom with Neo4j is use indexes the find your start node (e.g. the Aman node in the above) then traverse from there. Jim ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user -- Amandeep +91-9878483857 -- Amandeep +91-9878483857 ___ 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 ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user -- Amandeep +91-9878483857 -- Amandeep +91-9878483857 ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] Extent of Indexing
Mattias, I just listed one of the use cases, I have ample types of relationships in my database. I will be connecting all the 50k users to certain common nodes that will depict something about the users. Example: A user node can be directly/indirectly related to a place node that will depict the places where users visit daily. Now please consider this scenario, because this is where I am facing problem... I have stored all data regarding user in user node (like age etc in the way described above). A user node is also connected to various nodes that he posted. Suppose that I have 50k users and each of them has posted 10 posts. Now I want to find out what posts have the people of certain age posted. How do I do that? I believe I WILL have to use indexing. If there is any way possible via traversals, please share the same. ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
[Neo4j] Generating suggestions in a Neo4j db
This is an extension of previous questions that I had posted (although no knowledge of them is needed to understand this). Here's what the relations look like in my db... User1---VISITED PLACES--- Empty NodeHAS VISITED Usa User2---VISITED PLACES--- Empty NodeHAS VISITED Usa User1---VISITED PLACES--- Empty NodeHAS VISITED Canada User2---VISITED PLACES--- Empty NodeHAS VISITED Canada User1---VISITED PLACES--- Empty NodeHAS VISITED India (The Usa nodes are the same one). Each user has his/her own VISITED PLACES empty node (so that the point from where all these relations emerge are centralized). User1 and User2 are friends. Now, as User1 and User2 have most of their visited places common, I want to generate suggestions of places (here India) where User2 can visit (based upon the places where User2's friends have visited)... How can I do that? Any suggestions regarding the same? Indexing or Traversals?? ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] Generating suggestions in a Neo4j db
Hi Jim, The way you mentioned, that will take care of these suggestions, thanks for the same. But here's a tougher problem If I have a database of 50k people, and I want to find friends based upon the places that those 50k people have visited (i.e. People who have visited same places as me should be suggested as friends to me), then how to to that... I've thought all that I could, but I always come up with something stupid... Any suggestions about this? On 6/18/11, Jim Webber j...@neotechnology.com wrote: Hi Aman, I'm puzzled. Why not Aman--HAS_VISITED--USA Jim--HAS_VISITED--India And if: Aman--FRIEND-OF--Jim Then you just need to traverse from Aman following outgoing FRIEND_OF relationships to all your friends, and then traverse out their outgoing HAS_VISITED relationships to find places your friends have been. The general idiom with Neo4j is use indexes the find your start node (e.g. the Aman node in the above) then traverse from there. Jim ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user -- Amandeep +91-9878483857 ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] Generating suggestions in a Neo4j db
Hi Jim, The way you mentioned, that will take care of these suggestions, thanks for the same. But here's a tougher problem If I have a database of 50k people, and I want to find friends based upon the places that those 50k people have visited (i.e. People who have visited same places as me should be suggested as friends to me), then how to to that... I've thought all that I could, but I always come up with something stupid... Any suggestions about this? On 6/18/11, Aman aman.6...@gmail.com wrote: Hi Jim, The way you mentioned, that will take care of these suggestions, thanks for the same. But here's a tougher problem If I have a database of 50k people, and I want to find friends based upon the places that those 50k people have visited (i.e. People who have visited same places as me should be suggested as friends to me), then how to to that... I've thought all that I could, but I always come up with something stupid... Any suggestions about this? On 6/18/11, Jim Webber j...@neotechnology.com wrote: Hi Aman, I'm puzzled. Why not Aman--HAS_VISITED--USA Jim--HAS_VISITED--India And if: Aman--FRIEND-OF--Jim Then you just need to traverse from Aman following outgoing FRIEND_OF relationships to all your friends, and then traverse out their outgoing HAS_VISITED relationships to find places your friends have been. The general idiom with Neo4j is use indexes the find your start node (e.g. the Aman node in the above) then traverse from there. Jim ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user -- Amandeep +91-9878483857 -- Amandeep +91-9878483857 ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] Extent of Indexing
Peter, The project requires quick retrieval of data bases upon certain parameters, which, without indexing, would not be feasible (as the relations that hold the data are all same, so simple traversals won't work). As I said earlier, I would have to extract data based upon combination of some parameters, which I could easily do by indexing the same data on different parameters and taking advantage of the lucene's queryparser. Regarding those 50k users, they will be making much use of the C and R or the CRUD (Reads will be the most used though). I estimate that at any time, 30-50% of them would be using the project. Suppose a user generates 20 new nodes and 20 new relationships (not relationship types) per day. I would not index the data that they're posting, but the node number, so that I get to node with less memory usage. That seems efficient to me because I may make use of more number of nodes, but I get a smaller Index. To index a node X ( with some data in it), I can index node Y (empty) that has a direct relation with X. The nodes are getting exhausted, but atleast it gives me a smaller and faster index (and I have virtually unlimited number of nodes with Neo4j). (I know this scheme might seem a little vague because I am wasting nodes, and someday when the scalability factor kicks in, I might have to rectify this!) Any suggestions regarding the same? Also, my database would need store mostly strings. What about putting up another layer in front of my neo4j db that maps those strings to ints so that I could index those easily in neo4j? Example of this can be: This addictional layer can map an email address (which I need to index) to a unique user id which I can index using Neo4j ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
[Neo4j] Traversals versus Indexing
What is faster - Traversals or Indexing? I mean if one has a database model that can offer a choice between the two, what should one choose? Also, what about when the scalability factor comes in? ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user