From relational to graph databases
Due to the poor performance of our relational database in answering graph-like questions, we may want to move our tabular data into a graph format.
First, we will consider a sensible graph schema for our data, based on the information we have available, before writing a pipeline to move data from MySQL into a Python igraph network. By doing this, we can benchmark how a graphical approach to our path-based question performs, in comparison to the same question we answered with SQL.
Schema design
In our tables, we have two types of entities, users and games, which have different properties. Because of this, it is wise to consider users and games as different node types.
For users, we only have a unique ID for each user. To add data to an igraph graph, we will need to add an increasing integer igraph node ID for each distinct node, as we learned in Chapter 1, Introducing Graphs in the Real World, and Chapter 2, Working with Graph Data Models...