3

I have a Rails 4 app having to do with graphs. These graphs need to be stored and I'm not sure of the best way to do it. Firstly, the app has a SQLite db in development and PostgreSQL in production. I would love to have graphs in JSON, but that can be achieved in several ways. Also, these graphs are going to be manipulated using some interface. I was thinking a graphical solution and a raw one in JSON.

I have some alternatives to implementation:

  1. Store the graph JSON files directly in the db. (how?)
  2. Store the graphs in db with tables (graph, edges, vertex) (probably not...)
  3. Store the graphs in db with tables and build a parser to manipulate the in JSON format.

What is your recommendations?

3
  • Where is your question?
    – tjons
    Commented Sep 4, 2013 at 15:50
  • Let me spell it out for you ;-)
    – mfaerevaag
    Commented Sep 4, 2013 at 15:55
  • The recommendation thing was not there earlier. Or, I just missed it ;)
    – tjons
    Commented Sep 4, 2013 at 15:59

1 Answer 1

2

It looks like you're talking about mathematical graphs, not charts per se. I read a pretty nice presentation on using Postgres for storing graph-type data. It covers several different data modeling options that can work with an RDBMS. You might also want to consider using a specialized graph database (neo4j) for graph-related needs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.