在数据库中存储大量图数据结构
这个问题 询问如何在关系数据库中存储单个图。在这种情况下,解决方案很明确:一张表用于节点,一张表用于边。
我有一个随着时间的推移而演变的图形数据结构,所以我想将该图形的“快照”存储在数据库中。我想象有数百张这样的快照。
一种解决方案是为每个快照创建一对全新的节点和边表对(如上所述)。有更好的解决方案吗?
编辑:有人问我想用这个数据库做什么。我相信我不会做任何查询,除非将所有图表从C++转储到MySQL,然后将其全部加载回C++数据结构。因此,我希望使用 MySQL 进行存储,而不是进行高效的随机访问/搜索。
This question asks about storing a single graph in a relational database. The solution is clear in that case: one table for nodes, one table for edges.
I have a graph data structure that evolves over time, so I would like to store "snapshots" of this graph in a database. I imagine having hundreds of such snapshots.
One solution is to create a whole new table pair of nodes and edges (as above) for each snapshot. Is there a better solution?
EDIT: It was asked what I would like to do with this database. I believe that I will not be doing any querying except to dump all of the graphs to MySQL from C++ and then load it all back into C++ data structures. So I'm looking to use MySQL for storage and not for efficient random access / searching.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要一个表
,并且需要节点和边表,但需要有对图形表的外键引用。这样您就可以在数据库中拥有任意数量的图表。
You need a table
and you need the nodes and edges tables but with a foriegn key reference to the graphs table. This way you can have an arbitrary number of graphs in the database.