Storage of a large number of graphic data structures in a database

This question asks about storing one chart in a relational database. The solution in this case is clear: one table for nodes, one table for edges.

I have a graph data structure that evolves over time, so I would like to save the β€œsnapshots” of this graph in the database. I imagine hundreds of such shots.

One solution is to create a whole new pair of tables of nodes and edges (as indicated above) for each snapshot. Is there a better solution?

EDIT: asked what I would like to do with this database. I believe that I will not make any requests, except to deduce all of the graphs in MySQL from C ++, and then load it all back into C ++ data structures. Therefore, I am looking to use MySQL for storage, and not for efficient random access / search.

+4
source share
1 answer

You need a table

graphs = (graphid, dateofsnapshot or other things unique to the snapshot) 

and you need tables of nodes and edges, but with a link to the foriegn key to the graph table. Thus, you can have an arbitrary number of graphs in the database.

+5
source

All Articles