How Neo4j stores data internally?

后端 未结 1 1543
不思量自难忘°
不思量自难忘° 2020-12-14 20:30

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 st

相关标签:
1条回答
  • 2020-12-14 21:16

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

    A node references:

    • its first label (my guess is that labels are stored as a singly linked list)
    • its first property (properties are organized as a singly linked list)
    • its start/end relationships

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

    • its first property (same as nodes)
    • the predecessor and successor relationship of its start node
    • the predecessor and successor relationship of its end node

    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.

    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).

    0 讨论(0)
提交回复
热议问题