Surrounded by Graphs

Julian Simpson
Julian SimpsonSoftware Engineer at The Build Doctor
Surrounded by Graphs
a short introduction to Graph Databases
and Neo4j
Created by , Neo Technology Inc.Julian Simpson
@builddoctor
Introduction: Who are you?
Yes, you!
0
Introduction: Who am I?
Dotbomb Solaris Admin
Reformed Java Build Monkey
DevOps Agitator
(Who actually went to DevOpsDays conference #1)
Full Stack Developer at Neo Technology, makers of Neo4j
Agenda: What's this talk about?
NoSQL Landscape
What are graphs, really?
Graph Examples
Neo4j Example and Story Time
Questions
Define NoSQL
(from: http://martinfowler.com/bliki/NosqlDe nition.html)
Not using the relational model (nor the SQL language)
Open source (mostly)
Designed to run on large clusters (mostly)
Based on the needs of 21st century web properties
No schema, allowing elds to be added to any record without controls
4 kinds of NoSQL Database
Key-Value (e.g. BerkeleyDB, Redis)
Document (e.g. MongoDB, CouchDB)
Column Family (e.g. Cassandra, Vertica)
Graph (e.g. Neo4j, In niteGraph)
Most content stolen from NoSQL Distilled: A Brief Guide to the Emerging
World of Polyglot Persistence Paperback – August 18, 2012 by Pramod J.
Sadalage, Martin Fowler
Key Value
Definition
A simple hash table, primarily used when all access to
the database is via primary key
Example
<SEThobbit:name"baggins"
OK
<GEThobbit:name
"baggins"
Key Value
Use Cases
Recommended Not Recommended
Storing Session Information Relationships among data
User Pro les and Preferences Multi Operation Transactions
Shopping Cart Data Operations by Sets
Query by Data
Document Database
Definition
... documents are self-describing, hierarchical tree
data structures which can consist of maps, collections
and scalar values.
Example
{
"_id":1,
"name":{
"first":"Bilbo",
"last":"Baggins"
},
"comment":"Aren'twegladthishobbitbusinessisdone?"
}
Document Database
Use Cases
Recommended Not Recommended
Event Logging Complex Transactions spanning di erent
documents
Blogging, CMS
platforms
Queries against varying aggregate structure
Web or Real-Time
analytics
E-Commerce
Column Family Stores
Definition
... store data with keys mapped to values and the
values grouped into multiple column families, each
column family being a map of data
Example
{
"bilbo":{
age:"eleventysix",
surname:"baggins"
},
"frodo":{
nickname:"Mr.Frodo",
surname:"Baggins"
}
Column Family Stores
Use Cases
Recommended Not Recommended
Event Logging ACID Transactions
Content Management Systems, Blogging
platforms
Early Prototypes and
Spikes
Counters
Expiring Usage
Graph Databases
Definition
... store entities and relationships between those
entities.
Example
create(bilbo:Hobbit{name:'BilboBaggins'});
create(frodo:Hobbit{name:'FrodoBaggins'});
create(bilbo)-[:UNCLE_OF]->(frodo);
Graph Databases
Use Cases
Recommended Not Recommended
Connected Data Cases where you update all (or a
subset) of entities
Routing, Dispatch, Location
based services
(because Global Graph Operations)
Recommendation Engines
Fraud Detection
Chart or Graph?
Chart or Graph?
image: giphy.com
Chart or Graph?
From Ancient Greek su x -γραφω (-graphō), from
γράφω (gráphō, “to scratch, to scrape, to graze”),
from whence also -graphy.
Wiktionary
Chart or Graph?
Every invariant and covariant thus becomes
expressible by a graph precisely identical with a
Kekuléan diagram or chemicograph.
JJ Sylvester, 1878
image: Wikipedia
Graph all the bridges
image: Wikipedia
Graph all the bridges
image: Wikipedia
Graph all the things: Make
all:foobarbaz
bar:
touchbar
foo:bar
touchfoo
baz:bar
touchbaz
Graph all the things: Make
digraphG{
n3[label="all",color="red"];
n5[label="bar",color="red"];
n6[label="baz",color="red"];
n2[label="examples/Makefile",color="green"];
n4[label="foo",color="red"];
n5->n3;
n6->n3;
n4->n3;
n5->n6;
n5->n4;
}
Graph all the things: Make
Graph all the things: Maven
Graph all the things: Git
http://www.cse.scu.edu/
Graph all the things: Linux
image: http://www.cse.scu.edu/
Story Time
(a convoluted Neo4j Demo)
Cool story
Cool story
digraphBook{
page1[label="You'reOnConcorde"];
page1->page6;
page6[label="Youmeetaliens"];
page6->page3 [label="Demandtogohome"];
page6->page4 [label="BondwithU-TY"];
page3[label="You'refeelingsleepy"];
page3->page5 [label="Haveanap"];
page3->page16[label="StayAwake"];
page3->page8 [label="YoumeetIncu"];
Cool graph
Cypher Query Language
Declarative, like SQL
Allows query or update of the graph
Built on ASCII art
Named after a Matrix character
Cypher Query Language
CREATE (page1:Beginning:Page{number:1,synopsis:'YouareonConcorde,andsomethingcomestowards
(page6:Page{number:6,synopsis:'Youininacircularroom'}),
(page3:Page{number:3,synopsis:'Youareinanotherroomwithotherpeople. Youarefeelingsleep
(page4:Page{number:4,synopsis:'YouasktheU-TYmastersaboutthemselves.'}),
page1-[:TURNS_TO]->page6,
page6-[:TURNS_TO{decision:'DemandtobetakentoEarth'}]->page3,
page6-[:TURNS_TO{decision:'AsktheU-TYaboutthemselves'}]->page4,
(page5:Page {number:4,synopsis:'Thereisabandonyourhead'}),
(page8:Page {number:8,synopsis:'YoumeetIncu,captivefromAlara'}),
(page16:Page{number:16,synopsis:'YoumeetIngmar,theSwedishkidfrom1682'}),
How many pages are there?
MATCH(p:Page)
RETURNcount(p)asPages;
+-------+
| Pages |
+-------+
| 80 |
+-------+
1 row
238 ms
How many endings are there?
match(e:Ending)
returncount(e)asEndings;
+---------+
| Endings |
+---------+
| 27 |
+---------+
1 row
25 ms
How many Decisions?
match(p1)-[r:TURNS_TO]->(p2)
wherehas(r.decision)
returncount(r.decision)asDecisions;
+-----------+
| Decisions |
+-----------+
| 59 |
+-----------+
1 row
198 ms
How many paths through the
book?
match(b:Beginning)-[r:TURNS_TO*]-(e:Ending)
returncount(b)asPaths;
+-------+
| Paths |
+-------+
| 125 |
+-------+
1 row
250 ms
What's the shortest path?
match(b:Beginning)-[r:TURNS_TO*]-(e:Ending)
returnlength(r)asLength,e.synopsisasEnding
orderbylength(r)
limit1;
+------------------------------------+
| Length | Ending |
+------------------------------------+
| 4 | "You fall asleep forever" |
+------------------------------------+
1 row
88 ms
What's the longest path?
match(b:Beginning)-[r:TURNS_TO*]-(e:Ending)
returnlength(r)asLength,e.synopsisasEnding
orderbylength(r)desc
limit1;
+--------------------------------------------------------------------------------+
|Length|Ending |
+--------------------------------------------------------------------------------+
|19 |"YousendtheU-TYontheirway,feelingguiltaboutabandoningIncu"|
+--------------------------------------------------------------------------------+
1row
138ms
What's in the shortest path?
match(b:Beginning),(e:Ending),
path=shortestPath((b)-[*]-(e))
returnnodes(path);
+---------------------------------------------------------
| [Node[20]{number:1,synopsis:"You are on Concorde, and so
| [Node[20]{number:1,synopsis:"You are on Concorde, and so
| [Node[20]{number:1,synopsis:"You are on Concorde, and so
Wat? Oh.
match(b:Beginning),(e:Ending),
path=shortestPath((b)-[*]-(e))
returnnodes(path)asShortestPath
limit1;
+----------------------------------------------------------------------------------------------------------------------
|ShortestPath|
+----------------------------------------------------------------------------------------------------------------------
|[Node[20]{number:1,synopsis:"YouareonConcorde,andsomethingcomestowardsyou"},Node[21]{number:6,synopsis:"Youi
+----------------------------------------------------------------------------------------------------------------------
Where is Ultima?
match(p:Page)
wherep.synopsis=~'.*Ultima.*'
returnp;
+-------------------------------------------------------------------+
|p |
+-------------------------------------------------------------------+
|Node[98]{number:101,synopsis:"YouFindUltima! Itisparadise."}|
+-------------------------------------------------------------------+
1row
5ms
What links to Ultima?
matchpage-[:TURNS_TO]->(p:Page{number:101})
returnpage;
+------+
| page |
+------+
+------+
0 row
4 ms
Does anything link to it?
matchn-[*]-(p:Page{number:101})
returnn,p;
+----------------------------------------------------------------------------------------------------------------------------
---------------------------------+
|n |p
|
+----------------------------------------------------------------------------------------------------------------------------
---------------------------------+
|Node[2684]{number:104,synopsis:"Yournewfriendsletyouhangoutanytimeyoulike"}|Node[2683]{number:101,synopsis:"You
FindUltima! Itisparadise."}|
+----------------------------------------------------------------------------------------------------------------------------
---------------------------------+
1row
10ms
Ultima Visualized
About Neo4j
Drivers for Java, Ruby, Python, Scala, Perl, Clojure (and more)
GPL Community edition
AGPL Enterprise
Written in Java and Scala
Open sourced in 2007
https://github.com/neo4j/neo4j
http://neo4j.com
Thank you
Questions?
@neo4j
@builddoctor
image: memegenerator
Circular Dependencies
create (alice:Person {name:"Alice"})-[:LOVES]->
(bob:Person {name:"Bob"}),
(bob)-[:LOVES]->(carol:Person {name:"Carol"}),
(carol)-[:LOVES]->(alice)
Circular Dependencies
match (n)-[:LOVES]->(m) return n.name,m.name
+-------------------+
| n.name | m.name |
+-------------------+
| "Alice" | "Bob" |
| "Bob" | "Carol" |
| "Carol" | "Alice" |
+-------------------+
6 rows
39 ms
1 of 48

Recommended

関数プログラマから見たPythonと機械学習 by
関数プログラマから見たPythonと機械学習関数プログラマから見たPythonと機械学習
関数プログラマから見たPythonと機械学習Masahiro Sakai
31.4K views29 slides
Java & OOP Core Concept by
Java & OOP Core ConceptJava & OOP Core Concept
Java & OOP Core ConceptPin-Lun Huang
193 views70 slides
Fluent14 by
Fluent14Fluent14
Fluent14Brendan Eich
8.9K views40 slides
ExpLOD: a framework for explaining recommendations based on the Linked Open D... by
ExpLOD: a framework for explaining recommendations based on the Linked Open D...ExpLOD: a framework for explaining recommendations based on the Linked Open D...
ExpLOD: a framework for explaining recommendations based on the Linked Open D...Fedelucio Narducci
346 views35 slides
Presentazione Ilt Uk by
Presentazione Ilt UkPresentazione Ilt Uk
Presentazione Ilt UkItalian Luxury Travel
954 views165 slides
Armchair Capabilities by
Armchair CapabilitiesArmchair Capabilities
Armchair CapabilitiesRhonda Vincent
286 views24 slides

More Related Content

Similar to Surrounded by Graphs

All About GRAND Stack: GraphQL, React, Apollo, and Neo4j (Mark Needham) - Gre... by
All About GRAND Stack: GraphQL, React, Apollo, and Neo4j (Mark Needham) - Gre...All About GRAND Stack: GraphQL, React, Apollo, and Neo4j (Mark Needham) - Gre...
All About GRAND Stack: GraphQL, React, Apollo, and Neo4j (Mark Needham) - Gre...GreeceJS
547 views60 slides
A general introduction to Spring Data / Neo4J by
A general introduction to Spring Data / Neo4JA general introduction to Spring Data / Neo4J
A general introduction to Spring Data / Neo4JFlorent Biville
2.8K views42 slides
Odessapy2013 - Graph databases and Python by
Odessapy2013 - Graph databases and PythonOdessapy2013 - Graph databases and Python
Odessapy2013 - Graph databases and PythonMax Klymyshyn
56.8K views40 slides
TinkerPop: a story of graphs, DBs, and graph DBs by
TinkerPop: a story of graphs, DBs, and graph DBsTinkerPop: a story of graphs, DBs, and graph DBs
TinkerPop: a story of graphs, DBs, and graph DBsJoshua Shinavier
8.4K views47 slides
Creating Custom Charts With Ruby Vector Graphics by
Creating Custom Charts With Ruby Vector GraphicsCreating Custom Charts With Ruby Vector Graphics
Creating Custom Charts With Ruby Vector GraphicsDavid Keener
1.4K views28 slides
Graphql usage by
Graphql usageGraphql usage
Graphql usageValentin Buryakov
413 views37 slides

Similar to Surrounded by Graphs(20)

All About GRAND Stack: GraphQL, React, Apollo, and Neo4j (Mark Needham) - Gre... by GreeceJS
All About GRAND Stack: GraphQL, React, Apollo, and Neo4j (Mark Needham) - Gre...All About GRAND Stack: GraphQL, React, Apollo, and Neo4j (Mark Needham) - Gre...
All About GRAND Stack: GraphQL, React, Apollo, and Neo4j (Mark Needham) - Gre...
GreeceJS547 views
A general introduction to Spring Data / Neo4J by Florent Biville
A general introduction to Spring Data / Neo4JA general introduction to Spring Data / Neo4J
A general introduction to Spring Data / Neo4J
Florent Biville2.8K views
Odessapy2013 - Graph databases and Python by Max Klymyshyn
Odessapy2013 - Graph databases and PythonOdessapy2013 - Graph databases and Python
Odessapy2013 - Graph databases and Python
Max Klymyshyn56.8K views
TinkerPop: a story of graphs, DBs, and graph DBs by Joshua Shinavier
TinkerPop: a story of graphs, DBs, and graph DBsTinkerPop: a story of graphs, DBs, and graph DBs
TinkerPop: a story of graphs, DBs, and graph DBs
Joshua Shinavier8.4K views
Creating Custom Charts With Ruby Vector Graphics by David Keener
Creating Custom Charts With Ruby Vector GraphicsCreating Custom Charts With Ruby Vector Graphics
Creating Custom Charts With Ruby Vector Graphics
David Keener1.4K views
The openCypher Project - An Open Graph Query Language by Neo4j
The openCypher Project - An Open Graph Query LanguageThe openCypher Project - An Open Graph Query Language
The openCypher Project - An Open Graph Query Language
Neo4j2.2K views
Apache Storm 0.9 basic training - Verisign by Michael Noll
Apache Storm 0.9 basic training - VerisignApache Storm 0.9 basic training - Verisign
Apache Storm 0.9 basic training - Verisign
Michael Noll233.8K views
Survive JavaScript - Strategies and Tricks by Juho Vepsäläinen
Survive JavaScript - Strategies and TricksSurvive JavaScript - Strategies and Tricks
Survive JavaScript - Strategies and Tricks
Juho Vepsäläinen5.2K views
03 introduction to graph databases by Neo4j
03   introduction to graph databases03   introduction to graph databases
03 introduction to graph databases
Neo4j230 views
Ehtsham Elahi, Senior Research Engineer, Personalization Science and Engineer... by MLconf
Ehtsham Elahi, Senior Research Engineer, Personalization Science and Engineer...Ehtsham Elahi, Senior Research Engineer, Personalization Science and Engineer...
Ehtsham Elahi, Senior Research Engineer, Personalization Science and Engineer...
MLconf7.8K views
Stream Processing in the Cloud - Athens Kubernetes Meetup 16.07.2019 by Rafał Leszko
Stream Processing in the Cloud - Athens Kubernetes Meetup 16.07.2019Stream Processing in the Cloud - Athens Kubernetes Meetup 16.07.2019
Stream Processing in the Cloud - Athens Kubernetes Meetup 16.07.2019
Rafał Leszko138 views
Scio - Moving to Google Cloud, A Spotify Story by Neville Li
 Scio - Moving to Google Cloud, A Spotify Story Scio - Moving to Google Cloud, A Spotify Story
Scio - Moving to Google Cloud, A Spotify Story
Neville Li2.5K views
GraphQL as an alternative approach to REST (as presented at Java2Days/CodeMon... by luisw19
GraphQL as an alternative approach to REST (as presented at Java2Days/CodeMon...GraphQL as an alternative approach to REST (as presented at Java2Days/CodeMon...
GraphQL as an alternative approach to REST (as presented at Java2Days/CodeMon...
luisw192K views
GraphQL & DGraph with Go by James Tan
GraphQL & DGraph with GoGraphQL & DGraph with Go
GraphQL & DGraph with Go
James Tan1K views

More from Julian Simpson

Adventures in infrastructure as code by
Adventures in infrastructure as codeAdventures in infrastructure as code
Adventures in infrastructure as codeJulian Simpson
1.9K views41 slides
Everything I learned about Continuous Integration, I learned from Systems Adm... by
Everything I learned about Continuous Integration, I learned from Systems Adm...Everything I learned about Continuous Integration, I learned from Systems Adm...
Everything I learned about Continuous Integration, I learned from Systems Adm...Julian Simpson
876 views29 slides
Continuous Integration, the minimum viable product by
Continuous Integration, the minimum viable productContinuous Integration, the minimum viable product
Continuous Integration, the minimum viable productJulian Simpson
4.3K views60 slides
Silos are for farmers by
Silos are for farmersSilos are for farmers
Silos are for farmersJulian Simpson
2.1K views37 slides
Lrug by
LrugLrug
LrugJulian Simpson
845 views48 slides
Agile Systems Admin by
Agile Systems AdminAgile Systems Admin
Agile Systems AdminJulian Simpson
644 views26 slides

More from Julian Simpson(7)

Adventures in infrastructure as code by Julian Simpson
Adventures in infrastructure as codeAdventures in infrastructure as code
Adventures in infrastructure as code
Julian Simpson1.9K views
Everything I learned about Continuous Integration, I learned from Systems Adm... by Julian Simpson
Everything I learned about Continuous Integration, I learned from Systems Adm...Everything I learned about Continuous Integration, I learned from Systems Adm...
Everything I learned about Continuous Integration, I learned from Systems Adm...
Julian Simpson876 views
Continuous Integration, the minimum viable product by Julian Simpson
Continuous Integration, the minimum viable productContinuous Integration, the minimum viable product
Continuous Integration, the minimum viable product
Julian Simpson4.3K views

Recently uploaded

The details of description: Techniques, tips, and tangents on alternative tex... by
The details of description: Techniques, tips, and tangents on alternative tex...The details of description: Techniques, tips, and tangents on alternative tex...
The details of description: Techniques, tips, and tangents on alternative tex...BookNet Canada
121 views24 slides
AMAZON PRODUCT RESEARCH.pdf by
AMAZON PRODUCT RESEARCH.pdfAMAZON PRODUCT RESEARCH.pdf
AMAZON PRODUCT RESEARCH.pdfJerikkLaureta
15 views13 slides
Voice Logger - Telephony Integration Solution at Aegis by
Voice Logger - Telephony Integration Solution at AegisVoice Logger - Telephony Integration Solution at Aegis
Voice Logger - Telephony Integration Solution at AegisNirmal Sharma
17 views1 slide
Info Session November 2023.pdf by
Info Session November 2023.pdfInfo Session November 2023.pdf
Info Session November 2023.pdfAleksandraKoprivica4
10 views15 slides
【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院 by
【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院
【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院IttrainingIttraining
34 views8 slides
TouchLog: Finger Micro Gesture Recognition Using Photo-Reflective Sensors by
TouchLog: Finger Micro Gesture Recognition  Using Photo-Reflective SensorsTouchLog: Finger Micro Gesture Recognition  Using Photo-Reflective Sensors
TouchLog: Finger Micro Gesture Recognition Using Photo-Reflective Sensorssugiuralab
15 views15 slides

Recently uploaded(20)

The details of description: Techniques, tips, and tangents on alternative tex... by BookNet Canada
The details of description: Techniques, tips, and tangents on alternative tex...The details of description: Techniques, tips, and tangents on alternative tex...
The details of description: Techniques, tips, and tangents on alternative tex...
BookNet Canada121 views
AMAZON PRODUCT RESEARCH.pdf by JerikkLaureta
AMAZON PRODUCT RESEARCH.pdfAMAZON PRODUCT RESEARCH.pdf
AMAZON PRODUCT RESEARCH.pdf
JerikkLaureta15 views
Voice Logger - Telephony Integration Solution at Aegis by Nirmal Sharma
Voice Logger - Telephony Integration Solution at AegisVoice Logger - Telephony Integration Solution at Aegis
Voice Logger - Telephony Integration Solution at Aegis
Nirmal Sharma17 views
【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院 by IttrainingIttraining
【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院
【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院
TouchLog: Finger Micro Gesture Recognition Using Photo-Reflective Sensors by sugiuralab
TouchLog: Finger Micro Gesture Recognition  Using Photo-Reflective SensorsTouchLog: Finger Micro Gesture Recognition  Using Photo-Reflective Sensors
TouchLog: Finger Micro Gesture Recognition Using Photo-Reflective Sensors
sugiuralab15 views
1st parposal presentation.pptx by i238212
1st parposal presentation.pptx1st parposal presentation.pptx
1st parposal presentation.pptx
i2382129 views
Igniting Next Level Productivity with AI-Infused Data Integration Workflows by Safe Software
Igniting Next Level Productivity with AI-Infused Data Integration Workflows Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Safe Software225 views
Five Things You SHOULD Know About Postman by Postman
Five Things You SHOULD Know About PostmanFive Things You SHOULD Know About Postman
Five Things You SHOULD Know About Postman
Postman27 views
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas... by Bernd Ruecker
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...
Bernd Ruecker26 views
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive by Network Automation Forum
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLiveAutomating a World-Class Technology Conference; Behind the Scenes of CiscoLive
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive
Empathic Computing: Delivering the Potential of the Metaverse by Mark Billinghurst
Empathic Computing: Delivering  the Potential of the MetaverseEmpathic Computing: Delivering  the Potential of the Metaverse
Empathic Computing: Delivering the Potential of the Metaverse
Mark Billinghurst470 views
HTTP headers that make your website go faster - devs.gent November 2023 by Thijs Feryn
HTTP headers that make your website go faster - devs.gent November 2023HTTP headers that make your website go faster - devs.gent November 2023
HTTP headers that make your website go faster - devs.gent November 2023
Thijs Feryn19 views
Business Analyst Series 2023 - Week 3 Session 5 by DianaGray10
Business Analyst Series 2023 -  Week 3 Session 5Business Analyst Series 2023 -  Week 3 Session 5
Business Analyst Series 2023 - Week 3 Session 5
DianaGray10209 views
Data-centric AI and the convergence of data and model engineering: opportunit... by Paolo Missier
Data-centric AI and the convergence of data and model engineering:opportunit...Data-centric AI and the convergence of data and model engineering:opportunit...
Data-centric AI and the convergence of data and model engineering: opportunit...
Paolo Missier34 views

Surrounded by Graphs