Neo4j 如何在内部存储数据? [英] How Neo4j stores data internally?

查看:19
本文介绍了Neo4j 如何在内部存储数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题是从开发者的角度出发的(不是专门针对用户),可能有点乱.我想知道节点和关系的结构如何在逻辑上存储在数据库中.就像,当我说我有 bla bla 信息时.在哪里?- 那么答案是,在 BOOK 中,要么以 Grid 形式要么以页面上的线条形式.在 RDBMS 的情况下,数据以网格/表格格式存储.但我无法理解图形是如何存储在 Neo4j/图形数据库中的.我使用的是 Neo4j 客户端 2.1.2.

My question is from the view of developer (not specifically respect to User) and may be bit messy. I want to know that how the structure of Nodes and Relationships is get stored in database logically. Like, when I say that I have bla bla information. Where? - then the answer is, in BOOK, either in form of Grid or lines on a page. In case of RDBMS, data is stored in Grid/Tabular format. But I am unable to understand how graph is get stored in Neo4j/graph database. I am using neo4j client 2.1.2.

推荐答案

http://www.slideshare.net/thobe/an-overview-of-neo4j-internals 已经很过时了,但这让您对 Neo4j 的逻辑表示有了一个很好的概述.

http://www.slideshare.net/thobe/an-overview-of-neo4j-internals is very outdated but this gives you a good overview of Neo4j logical representation.

节点引用:

  • 它的第一个标签(我的猜测是标签存储为单向链表)
  • 它的第一个属性(属性被组织成一个单向链表)
  • 它的开始/结束关系

关系被组织成双向链表.关系指向:

Relationships are organized as doubly linked lists. A relationship points to:

  • 它的第一个属性(与节点相同)
  • 其起始节点的前驱和后继关系
  • 其端节点的前驱和后继关系

由于这种链式结构,遍历的概念(即查询数据的方式)很容易出现.这就是像 Neo4j 这样的图数据库擅长遍历图结构数据的原因.

Because of this chaining structure, the notion of traversal (i.e. THE way of querying data) easily emerges. That's why a graph database like Neo4j excels at traversing graph-structured data.

我粗略的猜测也是,因为 Neo4j 2.1 版(和 其新引入的密集节点管理),节点的关系按类型隔离.通过这样做,如果一个节点 N 例如是 5 个类型 A 关系和 500 万个类型 B 关系的起始节点,则遍历类型 A 的 N 关系仍然是 O(n=5).

My rough guess would be also, since Neo4j version 2.1 (and its newly introduced dense node management), nodes' relationships are segregated by type. By doing so, if a node N is for example a start node for 5 relationships of type A and for 5 million rels of type B, traversing rels of type A for N remains O(n=5).

这篇关于Neo4j 如何在内部存储数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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