You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @pengux,
do you have a specific use case in mind? Which operations would you expect to be able to (efficiently) perform on those collections?
RethinkDB hasn't been designed as a graph database the way some other specialized products have. That doesn't mean however that we couldn't add features to make small-scale graph processing possible in RethinkDB at some point.
@danielmewes I was thinking on simple use cases such as "Select all documents that are connected to document A" and a directed graph like "Select all users who added user A as friend but is not on user A's friend list". Some of the other document databases such as Arangodb have this and even Postgresql is capable of graph modelling. Would be nice for Rethinkdb to have these features but in the spirit of Rethinkdb in terms of efficiency and orthogonality.
@pengux You can currently model this in RethinkDB using a multi index.
r.tableCreate("nodes");r.table("nodes").indexCreate("out",{multi: true});// Insert an unconnected noder.table("nodes").insert({out: []});// Add an edge from node a to node b (where `a` and `b` are the primary keys of those nodes in the table)r.table("nodes").get(a).update({out: r.row("out").append(b)});// Get all nodes directly reachable from ar.table("nodes").get(a)("out");// Get all nodes that lead to a (the "incoming" edges of a)r.table("nodes").getAll(a,{index: "out"});// All nodes that lead to a but are not directly reachable from a (your friends of user A example)r.table("nodes").getAll(a,{index: "out"}).setDifference(r.table("nodes").get(a)("out"));
I this more or less what you were thinking of?
This is not as efficient as it would be in a specialized graph database, but should do the trick for small to medium-scale graph queries.
@danielmewes Yes, as with the other DBs, you can model it to get these results, but it's not efficient. Would it be possible to create specialized nodes/edgeds collection, or maybe graph indexes so it can be truly optimised and efficient?
This would be a major extension of our current feature set. We will discuss this once we get some major outstanding improvements to our current core feature set our of the way.
Since you seem to have experience with using graph databases: Is there anything you would like to see in a possible RethinkDB implementation that you think other systems don't provide (or not provide well)? Any mistakes we should definitely avoid?
@danielmewes Not really anything special on the top of my head. But it should be simple to handle cyclic relations (A cannot have an edge to itself for example) and also easy to do explicit/implicit relations.
Based on betting exchange gaming, players match their bets (at a given stake and odd) with others players. There a lot of cross relationships in that just simple scenario for which graph capabilities help a lot in a simple and natural way (if possible with sort of ACID transaction).
@felixis-1 Unfortunately we don't have a schedule for this currently.
Since ReQL doesn't support recursion or non-functional loops at the moment, it's probably tricky to calculate strongly connected nodes directly in ReQL. It might be possible somehow, but I suspect that it's significantly easier to do it in a piece of application code that runs multiple ReQL queries to request the next set of nodes from the graph.
Activity
danielmewes commentedon Oct 6, 2014
Hi @pengux,
do you have a specific use case in mind? Which operations would you expect to be able to (efficiently) perform on those collections?
RethinkDB hasn't been designed as a graph database the way some other specialized products have. That doesn't mean however that we couldn't add features to make small-scale graph processing possible in RethinkDB at some point.
pengux commentedon Oct 6, 2014
@danielmewes I was thinking on simple use cases such as "Select all documents that are connected to document A" and a directed graph like "Select all users who added user A as friend but is not on user A's friend list". Some of the other document databases such as Arangodb have this and even Postgresql is capable of graph modelling. Would be nice for Rethinkdb to have these features but in the spirit of Rethinkdb in terms of efficiency and orthogonality.
danielmewes commentedon Oct 7, 2014
@pengux You can currently model this in RethinkDB using a multi index.
I this more or less what you were thinking of?
This is not as efficient as it would be in a specialized graph database, but should do the trick for small to medium-scale graph queries.
pengux commentedon Oct 7, 2014
@danielmewes Yes, as with the other DBs, you can model it to get these results, but it's not efficient. Would it be possible to create specialized nodes/edgeds collection, or maybe graph indexes so it can be truly optimised and efficient?
danielmewes commentedon Oct 7, 2014
I see, thanks for the clarification @pengux.
This would be a major extension of our current feature set. We will discuss this once we get some major outstanding improvements to our current core feature set our of the way.
Since you seem to have experience with using graph databases: Is there anything you would like to see in a possible RethinkDB implementation that you think other systems don't provide (or not provide well)? Any mistakes we should definitely avoid?
pengux commentedon Oct 9, 2014
@danielmewes Not really anything special on the top of my head. But it should be simple to handle cyclic relations (A cannot have an edge to itself for example) and also easy to do explicit/implicit relations.
thelinuxlich commentedon Nov 19, 2014
For reference, ArangoDB has graph traversal: https://docs.arangodb.com/Traversals/README.html
Eliakos commentedon Mar 9, 2016
I support too the idea for rethinkdb to be a multi model db by adding graph capabilities and so, go beyond too simple relationships management such exposed here https://rethinkdb.com/docs/data-modeling/.
I were asked on slack to a bring the specific use case i exposed on slack :
Based on betting exchange gaming, players match their bets (at a given stake and odd) with others players. There a lot of cross relationships in that just simple scenario for which graph capabilities help a lot in a simple and natural way (if possible with sort of ACID transaction).
danielmewes commentedon Jul 13, 2016
@felixis-1 Unfortunately we don't have a schedule for this currently.
Since ReQL doesn't support recursion or non-functional loops at the moment, it's probably tricky to calculate strongly connected nodes directly in ReQL. It might be possible somehow, but I suspect that it's significantly easier to do it in a piece of application code that runs multiple ReQL queries to request the next set of nodes from the graph.
makeshyft-tom-g commentedon May 21, 2017
I would love to see this feature as well.....I can't say much about my use case unfortunately....only to say its a valid use case.
lavvy commentedon Feb 12, 2018
+1
thelinuxlich commentedon Mar 26, 2018
@srh I think this should be closed since it is too broad and doesn't have a proposal.