Skip to content

Edge and graph collections #3142

Closed
Closed

Description

@pengux

Would it be possible to add edge and graph collections features to Rethinkdb?

Activity

  1. added this to the backlog milestone on Oct 6, 2014
  2. danielmewes commented on Oct 6, 2014

    @danielmewes
    Member

    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.

  3. pengux commented on Oct 6, 2014

    @pengux
    Author

    @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.

  4. danielmewes commented on Oct 7, 2014

    @danielmewes
    Member

    @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 node
    r.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 a
    r.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.

  5. pengux commented on Oct 7, 2014

    @pengux
    Author

    @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?

  6. danielmewes commented on Oct 7, 2014

    @danielmewes
    Member

    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?

  7. pengux commented on Oct 9, 2014

    @pengux
    Author

    @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.

  8. thelinuxlich commented on Nov 19, 2014

    @thelinuxlich
  9. Eliakos commented on Mar 9, 2016

    @Eliakos

    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).

  10. danielmewes commented on Jul 13, 2016

    @danielmewes
    Member

    @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.

  11. makeshyft-tom-g commented on May 21, 2017

    @makeshyft-tom-g

    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.

  12. lavvy commented on Feb 12, 2018

    @lavvy

    +1

  13. thelinuxlich commented on Mar 26, 2018

    @thelinuxlich

    @srh I think this should be closed since it is too broad and doesn't have a proposal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions