Graph Analysis over
Relational Database
Gabriele Ponzi, Senior Developer
@Gabriele_Ponzi
G.Ponzi> whoami
Senior developer at Arcade Analytics
MSc in Computer Science
Academic and work experience in Databases, Big Data and NoSQL
world, distributed data handling, information extraction and
visualisation
Passionate developer always been in love with cutting edge
technologies
Agenda
Goal: From relational to graph
Why and when perform analysis over a graph
Use cases good for graph analysis
Model Translation
From ER Model to Graph Model: mapping strategies
Demo
Goal: RDBMS as a graph
turn upside down your plain old RDBMS
explore relations as a graph
Why?
Joins are hard to write
Joins are for developers
Graph model is very close to the plain old normalized ER-model
Visual navigation is for human beings
Can perform Graph Algorithms on partial loaded data!
Data migration problems
Costs
Costs of importing into a graph database
Write custom process to export from RDBMS and import into a graph
Hard to keep in sync
work on OLD data
Time consuming
should wait for sync or import
Cost $$$ on maintenance
...then let’s avoid migration please!
...then let’s avoid migration please!
live queries are probably better!
Graph crash course
Graph
G = (V,E)
Graph: reference model
Property Graph Model
● Vertices
○ set of outgoing edges
○ set of incoming edges
○ collection of properties (key-value map)
● Edges
○ outgoing tail vertex
○ incoming head vertex
○ label that denotes the type of relationship
between its two vertices
○ collection of properties (key-value map)
Graph model crash course
Model pairwise relations between objects
Objects: “Nodes”, “Vertices”
Relations: “Edges”, “Arcs”, “Links”
Nodes (Vertices)
Objects in the graph, related by edges
Can contain information
Edges
Can be directed or undirected
Can store information, usually in the form of an edge “weight”
Use cases
Social media analysis
Forensic analysis
Recommendation
Algorithms
Shortest Path
Dijkstra
Page rank
Centrality
Modularity
Clustering, then max degree, min degree, average degree
Model translation
RDBMS Connector
How to perform a Graph Analysis over a data source
with a different data model?
RDBMS Connector
How to perform a Graph Analysis over a data source
with a different data model?
RDBMS Connector: General Workflow
RDBMS Connector: General Workflow
RDBMS Connector: General Workflow
RDBMS Connector: General Workflow
RDBMS Connector: General Workflow
Mapping strategies
Graph Model allows us to perform several optimisations
through the aggregation of some info.
Mapping strategies
Arcade provides two different strategies, each with a specific impact
on the mapping between the two domains:
naive strategy
naive-aggregate strategy
Mapping: naive strategy
Basic approach: E-R Model directly translated into a coherent Graph Model as
follows:
● Entity Vertex Type
● Relationship Edge Type
Pros:
● Fast
● Few mapping rules needed
Cons:
● Model overheads
Mapping: naive strategy
Naive strategy overhead
Mapping: naive aggregate strategy
Basic approach + aggregation: N-N Relationships are aggregated
● Entity Vertex Type
● Relationship Edge Type
● Join Table Aggregator Edge
Pros:
● Overhead decreasing
● Resulting graph is less complex, then analysis in simpler!
● Better performances
Cons:
● More mapping rules needed
Mapping: naive aggregate strategy
Strategies comparison
Strategies comparison
Naive strategy output Naive aggregate strategy output
Other useful model alterations
Aggregation of 1 or more
tables into a single Vertex
Type
Other useful model alterations
Aggregation of 1 or more
tables into a single Vertex
Type
Single table splitting into
multiple Vertex TypesOR
Other useful model alterations
Aggregation of 1 or more
tables into a single Vertex
Type
Single table splitting into
multiple Vertex TypesOR
Aggregation of 1 or more
Relationships into a single
Edge Type
Single Relationship splitting
into multiple Edge TypesOR
Other useful model alterations
Aggregation of 1 or more
tables into a single Vertex
Type
Single table splitting into
multiple Vertex TypesOR
Aggregation of 1 or more
Relationships into a single
Edge Type
Single Relationship splitting
into multiple Edge TypesOR
New Vertex or Edge Type definition could be useful too
Demo use case: DVD Rental
E-R Model
Demo use case: DVD Rental
Graph Model
(without aggregation)
Demo use case: DVD Rental
Graph Model
(without aggregation)
Demo time
Thanks for your attention!
Contact US
https://arcadeanalytics.com/
info@arcadeanalytics.com
+1 844-491-6161

Graph analysis over relational database