GraphDB & RedisGraph
Presented by :
Md. Farhan Memon
Presented at :
Mumbai Redis Meetup
Mar 07, 2020
What to expect?
●Graphs & Graph DB structures
●RedisGraph
○ Features
○ Installation
○ Cypher
○ Commands
●RedisInsight
●Benchmarks
What is a Graph Database?
Node
50%
Edge
50%
N1
E1
N2
Database Trends
Database Structure
Database with Graph API!
Graph DB
Tabular / SQL
Name Gender
Arya
Stark
Female
Jon Snow Male
Tyrion
Lannister
Male
Src Dest
1 1
2 3
3 2
Name
House Stark of
Winterfell
House Lannister of
Casterly Rock
House Reed of
Greywater Watch
Character Belong House
NoSQL
id: 1
name: Arya Stark
gender: Female
type: Character
belongs: [5]
id: 5
name: House Stark of
Winterfell
region: The North
words: Winter is Coming
type: House
Graph DB
+
Index-free Adjacency
Graph Native DB
Adjacency List
1 432
Adjacency Matrix
1
2
3
1 2 3
1
1 1
1
2
3
RedisGraph
Features
●Property Graph
○ Nodes
○ Relationships
○ Labels / Relationship Types
○ Properties
name:
RedisGraph
name:
RedisLabs
name:
Md. Farhan
Event
Company
Person
sponsored_by
presented_by
{ on: 7/3/20 }
●Schema Less
●Cypher Query Language
●Supports Aggregations, Arithmetic exp., Sorts, etc.
●Tabular Resultset
●Faster & Better bulk loading
Installation
RedisGraph Installation
# Ubuntu/Linux
$ sudo apt-get install build-essential cmake m4 automake peg libtool autoconf
# Mac
$ brew install cmake m4 automake peg libtool autoconf
$ git clone --recurse-submodules -j8 https://github.com/RedisGraph/RedisGraph.git
$ cd RedisGraph
$ make
On successful execution, compiled binary could be found at:
src/redisgraph.so
Cypher Query Language
●Open Standard - Supported by several Graph DBs
●WHAT rather than HOW
●Pattern matching
○ ASCII art for Graphs
■ () : node
■ - - > : relationship
●Most clauses from SQL
MATCH (e:Event)-[presented_by]->(p:Person)
WHERE e.name = “RedisGraph”
RETURN e.name, p.name
Commands
Commands
●GRAPH.QUERY [GraphName] [Query]
● GRAPH.EXPLAIN [GraphName] [Query]
●GRAPH.DELETE [GraphName]
A Quick Demo
CREATE (:Rider { name: 'Valentino Rossi' })-[:rides]->(:Team { name: 'Yamaha' }),
(:Rider { name: 'Dani Pedrosa' })-[:rides]->(:Team { name: 'Honda' }),
(:Rider { name: 'Andrea Dovizioso' })-[:rides]->(:Team { name: 'Ducati' })
MATCH (r:Rider)-[:rides]->(t:Team)
WHERE t.name = ‘Yamaha’
RETURN r, t
MATCH (r:Rider)-[:rides]->(t:Team { name: 'Ducati' })
RETURN count(r)
Queries
Graph Visualisation
RedisInsight Installation
●Download RedisInsight for Desktop from https://redislabs.com/redisinsight/
●Ubuntu
○ chmod +x redisinsight-<platform>-<version>
●Windows & Mac
○ Run the installer
●Run the executable: ./redisinsight-<platform>-<version>
●After the web server starts, open http://127.0.0.1:8001
●Add your first Redis database connection
Game of Thrones
-
Visualising the Complex Game
How to know
When you need Graph Database???
Use Case Scoring for RedisGraph
Use Cases
●Fraud Detection
●Recommendation Engine
●Social Networks
●Network Load Balancing
●Quickest Route to work
And many more...
Benchmarks
Data Sets
Name Description Vertices Edges
graph500 Synthetic Kronecker graph 2.4 M 64 M
twitter Twitter user-follower directed
graph
41.6 M 1.47 B
●K-hop path query time
●RedisGraph version: 1.0.0 GA
●Dated: January 2019
Benchmarks
Benchmarks
Benchmarks
Benchmarks
Md. Farhan Memon
/mdfarhanmemon
#Redis #MumbaiRedisMeetup #RedisLabs #RedisGraph #BombayShirts

Graph Databases - RedisGraph and RedisInsight