Neo4j 底層存儲結構分析

neo4j 中節點和關係的物理存儲模型
neo4j存儲模型
The node records contain only a pointer to their first property and their first relationship (in what is oftentermed the _relationship chain). From here, we can follow the (doubly) linked-list of relationships until we find the one we’re interested in, the LIKES relationship from Node 1 to Node 2 in this case. Once we’ve found the relationship record of interest, we can simply read its properties if there are any via the same singly-linked list structure as node properties, or we can examine the node records that it relates via its start node and end node IDs. These IDs, multiplied by the node record size, of course give the immediate offset of both nodes in the node store file.

上面的英文摘自<Graph Databases>(作者:IanRobinson) 一書,描述了 neo4j 的存儲模型。Node和Relationship 的 Property 是用一個 Key-Value 的雙向列表來保存的; Node 的 Relatsionship 是用一個雙向列表來保存的,通過關係,可以方便的找到關係的 from-to Node. Node 節點保存第1個屬性和第1個關係ID。

通過上述存儲模型,從一個Node-A開始,可以方便的遍歷以該Node-A爲起點的圖。下面給個示例,來幫助理解上面的存儲模型,存儲文件的具體格式在第2章詳細描述。
http://sunxiang0918.cn/2015/06/27/neo4j-%E5%BA%95%E5%B1%82%E5%AD%98%E5%82%A8%E7%BB%93%E6%9E%84%E5%88%86%E6%9E%90/

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章