Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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?

share|improve this question
    
Where is your question? –  TJonS Sep 4 '13 at 15:50
    
Let me spell it out for you ;-) –  mfaerevaag Sep 4 '13 at 15:55
    
The recommendation thing was not there earlier. Or, I just missed it ;) –  TJonS Sep 4 '13 at 15:59
add comment

1 Answer

up vote 2 down vote accepted

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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