Alexey Grigorev great question.
My answer is based on knowledge of the three types of graph data structures:
1. Adjacency matrices
2. Edge lists
3. Adjacency List
Irrespective of distributed or single instance, each data structure has its pros / cons.
Adjacency matrices are too large to write on disk, but they are the fastest for looking up graph data.
Edge lists are the most compact to distribute, but they require scanning the entire edge set to look up relationships.
Adjacency Lists are the middle ground. They allow for constant time lookup of vertices and then reduce the edge scans to those local to the vertices.
Therefore, when working with distributed graph data, I recommend finding a way to implement adjacency lists to distribute your graph across your cluster.
Cassandra is the distributed system with which I am most familiar (from the early Titan DB days in 2013).
In the book we are reading this week, we are working with adjacency lists across Cassandra partitions.
Chapter 5 goes into detail into how we do it.
LucidChart Images 5-7 through 5-12 illustrate how we do this.
Vertices and edges map to partitions in cassandra.
The key to understanding how to distribute a graph comes from understanding how we model the partition and clustering keys under the hood.
(to use graphs in Cassandra, you don't have to know the details)
The vertex tables work just like regular C* tables - nothing special there. You have partition keys and clustering columns like normal.
The fun parts come into to play with the edge tables!
The partition key of an edge table is:
- the outgoing vertex's entire primary key
The clustering key of an edge table is:
- the incoming vertex's entire primary key
- (maybe a property)
The images below are from Chapter 5 where we discuss this in detail.