ArangoDB数据库中'图表'的数量 [英] number of 'graphs' in a ArangoDB database

查看:332
本文介绍了ArangoDB数据库中'图表'的数量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在探索Arangodb,我不确定我是否正确理解如何使用ArangoDb中的图形概念。

假设我正在为社交网络建模。我应该为整个社交网络创建一张图吗?还是应该为每个人及其关联创建一张图?
我有这样的感觉,我应该使用单个图表......但是有没有与该选择有关的任何性能/功能问题?



也许潜在的问题是这样的:我应该将arangodb中的图形概念当作技术还是业务相关的概念?

谢谢

解决方案

您应该不使用每个人的图表。第一个快速答案是使用单个图。



总体而言,我认为您应该将图概念当作技术概念。话虽如此,通常情况下,(数学)图很容易模拟业务中产生的关系。因此,图形数据库中的技术概念图很好地映射到业务逻辑。

社交网络就是最好的例子之一。这里的典型问题是找到用户的朋友?,找到用户朋友的朋友?或从A人到B人的最短路径是什么?。对于涉及先验未知路径长度的问题,图形数据库将非常有用,例如在最短路径示例中。



回到原始问题:您应该首先查看关于数据的查询。然后,您需要创建它,以便这些查询方便地映射到数据存储可以回答的标准图形操作(或其他查询)。这就告诉你应该在同一个图表中包含哪些信息,哪些位属于不同的图表。

在你最初的社交网络用例中,我会假设你想运行涉及友谊关系链的查询,所以这些链中的边必须在同一个图中。然而,在更复杂的情况下,例如可以想象,你有一个友谊图和一个跟随图,它们都使用不同的边而是相同的顶点。在这种情况下,您的社交网络可能会有两张图。


I am exploring Arangodb and I am not sure I understand correctly how to use the graph concept in ArangoDb.

Let's say I am modelling a social network. Should I create a single graph for the whole social network or should I create a graph for every person and its connections ? I've got the feeling I should use a single graph... But is there any performance/fonctionality issue related to that choice ?

Maybe the underlying question is this: should I consider the graph concept in arangodb as a technical or as a business-related concept ?

Thanks

解决方案

You should use not use a graph per person. The first quick answer would be to use a single graph.

In general, I think you should treat the graph concept as a technical concept. Having said that, quite often, a (mathematical) graph models a relationship arising from business very naturally. Thus, the technical concept graph in a graph database maps very well to the business logic.

A social network is one of the prime examples. Typical questions here are "find the friends of a user?", "find the friends of the friends of a user?" or "what is the shortest path from person A to person B?". A graph database will be most useful for questions involving an a priori unknown path length, like for example in the shortest path example.

Coming back to the original question: You should start by looking at the queries you will have about your data. You then want to make it, so that these queries map conveniently onto the standard graph operations (or indeed other queries) your data store can answer. This then tells you what kind of information should be in the same graph, and which bits belong in separate graphs.

In your original use case of a social network, I would assume that you want to run queries involving chains of friendship-relations, so the edges in these chains must be in the same graph. However, in more complicated cases it is for example conceivable that you have a "friendship" graph and a "follows" graph, both using different edges but the same vertices. In that case you might have two graphs for your social network.

这篇关于ArangoDB数据库中'图表'的数量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆