Reputation: 1009
I have undertaken a project that tracks shops from where a user can buy an item. I have decided to use Neo4j as the database.
This is a part of the database that I have in mind: There is a node for each shop, and each of these nodes has child-nodes that store items available in that store.
Consider this scenario: Now a particular user (who always goes to one particular shop to buy all his items) wants to know alternative shops from where he can get all (or maximum) number of the items he wants to purchase.
The problem is that an exhaustive search of all the shops and all their items, followed by their matching will take a lot of space/time. Is there any procedure/algorithm that could help me solve this problem with minimum space/time cost?
P.S.: Please note that I would like to stick with Neo4j only, because it solves many of the other database problems very efficiently.
Upvotes: 2
Views: 1092
Reputation: 80633
your use case is actually perfect for a graph db. Could I recommend you implement your items as primary nodes and connect them to your stores?
Index your store nodes using Indexing Service. That will give you quick lookup for store and then any particular item is one traversal away. Getting all other stores for an item will also just be edge traversals at that point.
Hope this helps.
Upvotes: 3