The following article briefly describes the format of relationships on disk: Neo4j Performance Architecture Explained & 6 Tuning Tips
I have some additional questions about relationships on disk. Not sure where to ask this, so I thought I give a try here.
I'll ask my question using the following example graph.
The first diagram shows the graph. The second diagram illustrates how the nodes and relationships for that graph may appear on disk. There may be other possibilities depending on the order in which the relationships are created. But I believe this is one valid representation.
My question has to do with how the following fields in the relationship record are used: firstNextRelId, firstPrevRelId, secondNextRelId, secondPrevRelId.
My understanding is that the relationships for Node T are organized in a linked list using the previously mentioned fields of relationship records. The node record for T points to the start of that list using the firstRelId field.
If I want to iterate over the relationships for T, I start at the relationship record pointed to by T.firstRelId, and progress from that relationship through the linked list of relationships T is involved in using the firstNextRelId and secondNextRelId fields in the relationship records.
Whether I use firstNextRelId or secondNextRelId to find the next T relationship for a given relationship record depends on whether T is the first or second node in the given relationship. Thus as I'm walking the list for T, I might be switching back and forth using firstNextRelId and secondNextRelId, from one relationship node to the next, depending on T's role in each relationship.
So in my example, T has the following three relationships: (T)-[:tagged-with]->(H1), (U)-[:authored]->T, (T)-[:tagged-with]->(H2). And lets assume they were added in that order.
T's firstRel points to the relationship record for T->H1. And since T is the first node in this relationship, I progress to the next relationship for T, using the firstNextRelId field, which points to the :authored relationship record. T is the second node in that relationship, and so to progress to the next relationship for T, I would use the secondNextRelId, which points to the tagged-with relationship between T and H2.
Is my understanding of how these relationship record fields are used correct?
Thanks,
Michael-