用于无向图的 Nosql DB?

发布于 2024-09-25 20:04:32 字数 318 浏览 1 评论 0原文

我想存储数百万个节点的图,其中每个节点以无向方式链接到另一个节点(点 A 到 B,自动 B 指向 A)。我已经研究了 Neo4j、OrientDB 作为可能的解决方案,但它们似乎是面向有向图的,并且 Neo4j 对于超过 100 万个节点不是免费的,这对我来说不是一个解决方案。

您能帮我看看其他 NoSQL DB(Redis、CouchDB、MongoDB 等)中的哪一个最适合这样的事情以及如何实现它?我想进行一个无属性(只需给我链接的元素)具有 2 个深度级别的广度优先查询(具有 A<->B、B<->C、C<->D,查询 A 应该给我 B 和 C,但不要 D)。

I want to store a graph of millions of nodes where each node links to another in an undirected manner (point A to B, automatically B points to A). I have examined Neo4j, OrientDB as possible solutions but they seem to be oriented in directed graphs, and Neo4j not being free for >1 million nodes is not a solution for me.

Can you help me which of the other NoSQL DBs (Redis, CouchDB, MongoDB, ...) would suit best for something like this and how could it be implemented? I want to make a no-property (just give me the linked elements) breadth-first queries with 2 depth levels (having A<->B, B<->C, C<->D, querying A should give me B and C, but not D).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

や莫失莫忘 2024-10-02 20:04:32

OrientDB 对节点数量没有限制。此外,默认模型是双向的。您也可以免费将其用于商业目的,因为所应用的许可证是 Apache 2。

GraphDB 记录在此处:http://code.google.com/p/orient/wiki/GraphDatabase。基本上,您可以使用本机 API 或蓝图实现。本机 API 是 SQL 语言的演变,具有用于图形的特殊运算符。示例:

SELECT FROM Account WHERE Friends TRAVERSE (1,7) (address.city.country.name = 'New Zealand')

这意味着向我提供居住在新西兰的该朋友的所有帐户。朋友们被带到了第七层深处。

第二个允许使用完整的蓝图堆栈(例如 Gremlin 语言)来创建超级复杂的查询。

OrientDB has no limitation on the number of nodes. Furthermore the default model is bi-directional. You can use it for FREE also for commercial purposes, since the applied license is Apache 2.

The GraphDB is documented here: http://code.google.com/p/orient/wiki/GraphDatabase. Basilary you can use the native API or the Blueprints implementation. Native APIs has an evolution of the SQL language with special operators for graphs. Example:

SELECT FROM Account WHERE friends TRAVERSE (1,7) (address.city.country.name = 'New Zealand')

That means give me all the accounts with such friend that lives in New Zealand. Friends are taken up to the 7th level of deep.

The second one allows to use the full Blueprint stack such as the Gremlin language to create your super-complex queries.

水水月牙 2024-10-02 20:04:32

Neo4j 始终按定向存储关系/边,但是在遍历/查询时,您可以使用 Direction.BOTH 或者在某些情况下不定义方向全部。 (这样就不需要“双”边来覆盖两个方向,您只需忽略方向 - 并且“向后”遍历边时不会有性能损失。)

100 万个“基元”限制已经被删除了很长一段时间。如果您的代码是开源的,则可以将社区版本用于任何大小的数据库。对于其他情况,还有商业版本,其中包括一个免费替代方案

Neo4j always stores relationships/edges as directed, but when traversing/querying you can easily treat the graph as undirected by using Direction.BOTH or in some cases by not defining a direction at all. (This way there's no need for "double" edges to cover both directions, you simply ignore the direction - and there's no performance penalty when traversing edges "backwards".)

The 1 million "primitives" limit was removed for quite a while now. If your code is open source, you can use the community version for any size of the DB. For other cases there's the commercial versions which includes one free alternative.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文