图形数据库neo4j_PHP和Neo4j:图形数据库简介

图形数据库neo4j

For a long time, data has been typically stored in tabular form so as to increase the indexing and readability. Nowadays, the trends are changing as Graph databases are quickly gaining popularity. In fact, it would not be wrong to call them "the future of DBMS".

长期以来,数据通常以表格形式存储,以增加索引和可读性。 如今,随着Graph数据库Swift流行,趋势正在发生变化。 实际上,将它们称为“ DBMS的未来”并没有错。

New to the world of graphs and databases? Don't worry, by the end of this introductory article you will have sound theoretical knowledge about the topic – just enough to easily glide through the rest of the series – actual implementation.

图形和数据库世界的新手? 不用担心,在本介绍性文章的结尾,您将对该主题有全面的理论知识-足以轻松浏览本系列的其余部分-实际实现。

什么是图? (What are Graphs?)

Graphs are the most generic form of storing data in a visual manner in the world of data structures. Graphs store data in the form of nodes (data blocks) where one node points to another. We can reach any data block from another.

在数据结构领域中,图形是以可视方式存储数据的最通用形式。 图以节点(数据块)的形式存储数据,其中一个节点指向另一个节点。 我们可以到达另一个数据块。

什么是图形数据库? (What are Graph Databases?)

Technically, Graph Databases are a way of storing data in the form of nodes, edges and relationships which provide index-free adjacency.

从技术上讲,图形数据库是一种以节点,边和关系形式存储数据的方式,可提供无索引的邻接关系。

Now let's understand this – Data is stored in the form of nodes, every node (or data block) is connected to another one and this connection is called an edge. A few words are also mentioned on these edges to further define the connection between one node and the other – this description is called a relationship. Since each node can directly look-up the node it is connected to (they are all connected through edges, remember?), this eliminates the need of searching a data block by its 'index', hence the term 'index-free adjacency'.

现在让我们了解一下–数据以节点的形式存储,每个节点(或数据块​​)都连接到另一个节点 ,这种连接称为edge 。 在这些边缘上还提到了一些单词,以进一步定义一个节点与另一个节点之间的连接-这种描述称为关系 。 由于每个节点都可以直接查找与其连接的节点(它们都通过边连接,还记得吗?),因此无需通过“索引”来搜索数据块,因此无需术语“无索引邻接”

Today, most of the social networking sites like Facebook use graph databases to store their massive amount of data.

如今,像Facebook这样的大多数社交网站都使用图数据库来存储其大量数据。

图数据库的用法 (Usage of Graph databases)

Graph databases find their usage when data to be stored is associative, meaning when the relationship between two data blocks matters a lot. Relational databases (tabular form) are not that good when a relationship exists between two data blocks, especially if it's the relationship that's more important than the actual data blocks. Graph databases are a very intuitive and expressive way to describe any form of data – as if we're writing something on whiteboards. They let you represent related data as it is – as a set of objects connected by a set of relationships each with its own set of descriptive properties.

当要存储的数据具有关联性时,即当两个数据块之间的关系非常重要时,图数据库就会找到其用途。 当两个数据块之间存在关系时,关系数据库(表格形式)不是很好,特别是当关系比实际数据块更重要时。 图形数据库是描述任何形式的数据的一种非常直观且富有表现力的方式,就像我们在白板上写东西一样。 它们使您可以按原样表示相关数据–作为一组对象,这些对象通过一组关系连接,每个关系都具有自己的一组描述性属性。

We use them when…

我们在以下情况下使用它们:

  • …dealing with connected data. For eg., a social network platform – where along with personal details, the database depends on how two people are connected to each other because the amount of data visible between two friends will not be same if the two are not friends, but only acquaintances.

    ……处理连接的数据。 例如,一个社交网络平台,其中的数据库以及个人详细信息取决于两个人之间的联系方式,因为如果两个朋友不是朋友,而是两个朋友,那么两个朋友之间可见的数据量就不会相同。

  • …traversal is preferred to indexing. This means the case where we would 'move through' a part of database instead of directly jumping to one. For eg., an approval for exporting a car from a factory requires that the car have an engine and upholstery (not really but bear with me). At the management level, the procedure will consist of checking all the cars which have the above-mentioned properties. If the company is using graph databases to store this data, they would check each node (car) which has both properties attached to them and if not, discard and move ahead.

    …遍历比索引更可取。 这意味着我们将“遍历”数据库的一部分而不是直接跳转到其中一部分。 例如,从工厂出口汽车的批准要求该汽车具有发动机和内饰(不是真的,但我可以接受)。 在管理层,程序将包括检查所有具有上述特性的汽车。 如果公司正在使用图形数据库存储此数据,则他们将检查具有两个属性的每个节点(汽车),如果没有,则丢弃并继续。

  • …solving the traveling salesman problem. These are very common problems where the minimum possible route is to be calculated for reaching Point B from Point A when more than one option is available. Using various minimum distance algorithms one can find out the way with minimum cost if the destinations are stored in the form of graph databases.

    …解决旅行商问题。 这些是非常常见的问题,其中当有多个选项可用时,要计算从A点到达B点的最小可能路线。 如果将目的地以图形数据库的形式存储,则可以使用各种最小距离算法找到成本最低的方法。

  • …the next item to be searched for depends on the previous one. For eg., the database for a global enterprise which keeps the record of how a cookie is made from wheat. They will see how wheat flows through a farmer to a truck to a factory to a mixer to an oven to packaging and finally into a supermarket. Here all the stages may be connected to each other via nodes and thus moving from one to another would be easy.

    …要搜索的下一项取决于上一项。 例如,一个全球企业的数据库,其中记录着如何用小麦制成饼干。 他们将了解小麦如何流经农民,卡车,工厂,搅拌机,烤箱,包装,最后进入超市。 在这里,所有级都可以通过节点相互连接,因此从一个级移动到另一个级将很容易。

(Example)

alt

In this example, Mike has a teacher named George, whose son Ryan is his friend. This has been represented by writing relationships on the edges and properties in the circle. This is very close to how the data is actually stored in a graph database. It would not have been that easy if we were using a table to depict such a relationship.

在此示例中,迈克有一位叫乔治的老师,他的儿子瑞安是他的朋友。 这通过在圆的边缘和属性上写关系来表示。 这与实际将数据存储在图形数据库中的方式非常接近。 如果我们使用表来描述这种关系,那将不是那么容易。

图数据库的实际使用案例 (Real world use cases of graph databases)

Graph databases are becoming very popular in the real world. Here are some arenas where graph databases have found their use among the world's leading companies:

图形数据库在现实世界中变得非常流行。 以下是图形数据库已在世界领先公司中使用的一些领域:

  • Pagerank: Google uses the concept of graph databases in calculating the order of displaying the search results. A directed graph is used to connect the world wide web pages together as nodes and the hyperlinks to each other as the edges. The number of outgoing edges per graph is assigned as the weight for the edge. Thus, page rank is decided as per the weight on one edge as compared to other edges.

    Pagerank :Google使用图形数据库的概念来计算显示搜索结果的顺序。 有向图用于将万维网网页作为节点连接在一起,并将超链接彼此作为边缘连接在一起。 每个图形的输出边缘数被指定为边缘的权重。 因此,页面等级是根据一个边缘相对于其他边缘的权重来确定的。

  • Data Management: Cisco, one of the world's leading networking organizations, has recently adopted a hierarchical management system which is centrally based on the graph utility of the Neo4j database. This provides them with a very fast access to data as compared to Oracle RAC. They are implementing this concept on product hierarchy too in order to serve the user in real time.

    数据管理 :思科是世界领先的网络组织之一,最近采用了一种分层管理系统,该系统集中基于Neo4j数据库的图表实用程序。 与Oracle RAC相比,这使他们可以非常快速地访问数据。 他们也正在产品层次结构上实施此概念,以便实时为用户服务。

  • Social Interconnect : Websites like Facebook, Twitter, LinkedIn, Viadeo, Glassdoor are storing their connections in the form of graph databases as relationships. Recommendations are important from the point of view of their users. Relationships and connections can be very well managed and accessed in real time as compared to relational databases.

    社交互连 :诸如Facebook,Twitter,LinkedIn,Viadeo,Glassdoor之类的网站以图形数据库的形式将它们的关系存储为关系。 从用户的角度来看,建议很重要。 与关系数据库相比,可以很好地管理和实时访问关系和连接。

  • Network management : Telecommunication companies like SFR, Telenor, Huwai, JustDial have shifted to graph databases to model their network which consists of highly interconnected plans, customers and groups. Graphs help them in analyzing networks and data centers and also save them from the conventional time-consuming process of authentication. Most importantly, by using graphs, the failure cases are also covered and recovery plans are always just a node away which obviously saves a lot of time whenever any hazard occurs.

    网络管理 :SFR,Telenor,Huwai,JustDial等电信公司已转向图形数据库来建模其网络,该网络由高度互连的计划,客户和群体组成。 图形可以帮助他们分析网络和数据中心,还可以将它们从传统的耗时的身份验证过程中省下来。 最重要的是,通过使用图表,还可以涵盖故障案例,并且恢复计划始终仅在一个节点之外,无论何时发生任何危险,显然都可以节省大量时间。

  • Security and access management : The creative cloud of Adobe uses a graph database structure to link authentication details and thereby grant access to contents for its administrators as well as users.

    安全性和访问管理 :Adobe的创意云使用图形数据库结构链接身份验证详细信息,从而为其管理员和用户授予对内容的访问权限。

  • Bioinformatics : Era7 is a company that deals with DNA sequencing i.e., storing information on proteins, enzymes etc. This is done with the help of Bio4j, which is a bioinformatics graph DB system. It stores the information about genes, proteins and other complex interrelated information. Bio4j has all the features of Neo4j, world’s leading graph database, and is thus very scalable and flexible.

    生物信息学 :Era7是一家从事DNA测序的公司,即存储有关蛋白质,酶等的信息。这是在Bio4j(生物信息学图数据库系统)的帮助下完成的。 它存储有关基因,蛋白质和其他复杂相关信息的信息。 Bio4j具有世界领先的图形数据库Neo4j的所有功能,因此具有很高的可扩展性和灵活性。

结论 (Conclusion)

I hope you understand the theory behind graph databases a little better now. Coming soon, we'll be taking a detailed look at how to use Neo4j, the world's leading graph DB, with PHP.

希望您现在对图数据库的理论有所了解。 即将推出,我们将详细研究如何在PHP中使用世界领先的图形数据库Neo4j。

If you'd like a particular use case covered, please mention it in the comments!

如果您希望涵盖特定用例,请在评论中提及!

翻译自: https://www.sitepoint.com/php-neo4j-introduction-graph-databases/

图形数据库neo4j

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值