SlideShare une entreprise Scribd logo
1  sur  70
A	
  Li%le	
  Graph	
  Theory	
  for	
  the	
  
Busy	
  Developer	
  
Jim	
  Webber	
  
Chief	
  Scien?st,	
  Neo	
  Technology	
  
@jimwebber	
  
InfoQ.com: News & Community Site
• 750,000 unique visitors/month
• Published in 4 languages (English, Chinese, Japanese and Brazilian
Portuguese)
• Post content from our QCon conferences
• News 15-20 / week
• Articles 3-4 / week
• Presentations (videos) 12-15 / week
• Interviews 2-3 / week
• Books 1 / month
Watch the video with slide
synchronization on InfoQ.com!
http://www.infoq.com/presentations
/graph-database-theory
Presented at QCon New York
www.qconnewyork.com
Purpose of QCon
- to empower software development by facilitating the spread of
knowledge and innovation
Strategy
- practitioner-driven conference designed for YOU: influencers of
change and innovation in your teams
- speakers and topics driving the evolution and innovation
- connecting and catalyzing the influencers and innovators
Highlights
- attended by more than 12,000 delegates since 2007
- held in 9 cities worldwide
Roadmap	
  
•  Imprisoned	
  data	
  
•  Graph	
  models	
  
•  Graph	
  theory	
  
– Local	
  proper?es,	
  global	
  behaviors	
  
– Predic?ve	
  techniques	
  
•  Graph	
  matching	
  
– Real-­‐?me	
  analy?cs	
  for	
  fun	
  and	
  profit	
  
•  Fin	
  
h%p://www.flickr.com/photos/crazyneighborlady/355232758/	
  
h%p://gallery.nen.gov.uk/image82582-­‐.html	
  
Aggregate-­‐Oriented	
  Data	
  
h%p://mar?nfowler.com/bliki/AggregateOrientedDatabase.html	
  
“There is a significant downside - the whole approach works really well
when data access is aligned with the aggregates, but what if you want to
look at the data in a different way? Order entry naturally stores orders as
aggregates, but analyzing product sales cuts across the aggregate structure.
The advantage of not using an aggregate structure in the database is that it
allows you to slice and dice your data different ways for different
audiences.
This is why aggregate-oriented stores talk so much about map-reduce.”
complexity = f(size, connectedness, uniformity)
h%p://www.bbc.co.uk/london/travel/downloads/tube_map.html	
  
Property	
  graphs	
  
•  Property	
  graph	
  model:	
  
– Nodes	
  with	
  proper?es	
  
– Named,	
  directed	
  rela?onships	
  with	
  proper?es	
  
– Rela?onships	
  have	
  exactly	
  one	
  start	
  and	
  end	
  node	
  
•  Which	
  may	
  be	
  the	
  same	
  node	
  
stole	
  
from	
  
loves	
  
loves	
  
enemy	
  
enemy	
  
A	
  Good	
  Man	
  
Goes	
  to	
  War	
  
appeared	
  	
  
in	
  
appeared	
  	
  
in	
  
appeared	
  	
  
in	
  
appeared	
  	
  
in	
  
Victory	
  of	
  	
  
the	
  Daleks	
  
appeared	
  	
  
in	
  
appeared	
  	
  
in	
  
companion	
  
companion	
  
enemy	
  
Property	
  graphs	
  are	
  very	
  whiteboard-­‐friendly	
  
h%p://blogs.adobe.com/digitalmarke?ng/analy?cs/predic?ve-­‐analy?cs/predic?ve-­‐analy?cs-­‐and-­‐the-­‐digital-­‐marketer/	
  
h%p://en.wikipedia.org/wiki/File:Leonhard_Euler_2.jpg	
  
Meet	
  Leonhard	
  Euler	
  
•  Swiss	
  mathema?cian	
  
•  Inventor	
  of	
  Graph	
  
Theory	
  (1736)	
  
16	
  
Königsberg	
  (Prussia)	
  -­‐	
  1736	
  
A	
  
B	
  
D	
  
C	
  
A	
  
B	
  
D	
  
C	
  
1"
2"
3"
4"
7"
6"
5"
h%p://en.wikipedia.org/wiki/Seven_Bridges_of_Königsberg	
  
20	
  
Triadic	
  Closure	
  
name: Kyle
name: Stan name: Kenny
Triadic	
  Closure	
  
name: Kyle
name: Stan name: Kenny
name: Kyle
name: Stan name: Kenny
FRIEND
Structural	
  Balance	
  
name: Cartman
name: Craig name: Tweek
Structural	
  Balance	
  
name: Cartman
name: Craig name: Tweek
name: Cartman
name: Craig name: Tweek
FRIEND
Structural	
  Balance	
  
name: Cartman
name: Craig name: Tweek
name: Cartman
name: Craig name: Tweek
ENEMY
Structural	
  Balance	
  
name: Kyle
name: Stan name: Kenny
name: Kyle
name: Stan name: Kenny
FRIEND
Structural	
  Balance	
  is	
  a	
  key	
  
predic?ve	
  technique	
  
And	
  it’s	
  domain-­‐agnos?c	
  
Allies	
  and	
  Enemies	
  
UK	
  
Germany	
  France	
  
Russia	
   Italy	
  
Austria	
  
Allies	
  and	
  Enemies	
  
UK	
  
Germany	
  France	
  
Russia	
   Italy	
  
Austria	
  
Allies	
  and	
  Enemies	
  
UK	
  
Germany	
  France	
  
Russia	
   Italy	
  
Austria	
  
Allies	
  and	
  Enemies	
  
UK	
  
Germany	
  France	
  
Russia	
   Italy	
  
Austria	
  
Allies	
  and	
  Enemies	
  
UK	
  
Germany	
  France	
  
Russia	
   Italy	
  
Austria	
  
Allies	
  and	
  Enemies	
  
UK	
  
Germany	
  France	
  
Russia	
   Italy	
  
Austria	
  
Predic?ng	
  WWI	
  	
  [Easley	
  and	
  Kleinberg]	
  
Strong	
  Triadic	
  Closure	
  
It	
  if	
  a	
  node	
  has	
  strong	
  rela3onships	
  to	
  two	
  
neighbours,	
  then	
  these	
  neighbours	
  must	
  have	
  at	
  
least	
  a	
  weak	
  rela3onship	
  between	
  them.	
  
	
  
[Wikipedia]	
  
Triadic	
  Closure	
  
(weak	
  rela?onship)	
  
name: Kenny
name: Stan name: Cartman
Triadic	
  Closure	
  
(weak	
  rela?onship)	
  
name: Kenny
name: Stan name: Cartman
name: Kenny
name: Stan name: Cartman
FRIEND 50%
Weak	
  rela?onships	
  
•  Rela?onships	
  can	
  have	
  “strength”	
  as	
  well	
  as	
  
intent	
  
– Think:	
  weigh?ng	
  on	
  a	
  rela?onship	
  in	
  a	
  property	
  
graph	
  
•  Weak	
  links	
  play	
  another	
  super-­‐important	
  
structural	
  role	
  in	
  graph	
  theory	
  
– They	
  bridge	
  neighbourhoods	
  
Local	
  Bridges	
  
FRIEND
name: Kenny
name: Stanname: Kyle
FRIENDFRIEND
FRIEND
name: Sally
name: Bebename: Wendy
FRIENDFRIEND
FRIEND 50%
name: Cartman
FRIEND
ENEMY
Local	
  Bridge	
  Property	
  
“If	
  a	
  node	
  A	
  in	
  a	
  network	
  sa3sfies	
  the	
  Strong	
  
Triadic	
  Closure	
  Property	
  and	
  is	
  involved	
  in	
  at	
  
least	
  two	
  strong	
  rela3onships,	
  then	
  any	
  local	
  
bridge	
  it	
  is	
  involved	
  in	
  must	
  be	
  a	
  weak	
  
rela3onship.”	
  
	
  
[Easley	
  and	
  Kleinberg]	
  
University	
  Karate	
  Club	
  
Graph	
  Par??oning	
  
•  (NP)	
  Hard	
  problem	
  
– Recursively	
  remove	
  the	
  spanning	
  links	
  between	
  
dense	
  regions	
  
– Or	
  recursively	
  merge	
  nodes	
  into	
  ever	
  larger	
  
“subgraph”	
  nodes	
  
– Choose	
  your	
  algorithm	
  carefully	
  –	
  some	
  are	
  be%er	
  
than	
  others	
  for	
  a	
  given	
  domain	
  
•  Can	
  use	
  to	
  (almost	
  exactly)	
  predict	
  the	
  
break	
  up	
  of	
  the	
  karate	
  club!	
  
University	
  Karate	
  Clubs	
  
(predicted	
  by	
  Graph	
  Theory)	
  
9
University	
  Karate	
  Clubs	
  
(what	
  actually	
  happened!)	
  
Cypher	
  
•  Declara?ve	
  graph	
  pa%ern	
  matching	
  language	
  
– “SQL	
  for	
  graphs”	
  
– Columnar	
  results	
  
•  Supports	
  graph	
  matching	
  commands	
  and	
  
queries	
  
– Find	
  me	
  stuff	
  like	
  this…	
  
– Aggrega?on,	
  ordering	
  and	
  limit,	
  etc.	
  
Firstname:
Mickey
Surname: Smith
DoB: 19781006
SKU: 5e175641
Product:
Badgers
Nadgers Ale
SKU: 2555f258
Product:
Peewee Pilsner
Category: beer
SKU: 49d102bc
Product: Baby
Dry Nights
Category:
nappies
Category: baby Category:
alcoholic
drinks
SKU: 49d102bc
Product: XBox
360
Category:
consumer
electronics
Category:
console
BOUGHTBOUGHT
MEMBER_OF
MEMBER_OFMEMBER_OF
MEMBER_OFMEMBER_OF
Firstname: *
Surname: *
DoB: 1996 > x
> 1972
Category: beerCategory:
nappies
BOUGHTCategory: game
console
Firstname: *
Surname: *
DoB: 1996 > x
> 1972
Category: beerCategory:
nappies
!BOUGHTCategory: game
console
(beer)(nappies)
(console)
(daddy)
() ()
<-[b:BOUGHT]-()
Fla%en	
  the	
  graph	
  
(daddy)-[:BOUGHT]->()-[:MEMBER_OF]->(nappies)
(daddy)-[:BOUGHT]->()-[:MEMBER_OF]->(beer)
(daddy)-[b:BOUGHT]->()-[:MEMBER_OF]->(console)
Wrap	
  in	
  a	
  Cypher	
  MATCH	
  clause	
  
MATCH (daddy)-[:BOUGHT]->()-[:MEMBER_OF]->(nappies),
(daddy)-[:BOUGHT]->()-[:MEMBER_OF]->(beer),
(daddy)-[b:BOUGHT]->()-[:MEMBER_OF]->(console)
Cypher	
  WHERE	
  clause	
  
MATCH (daddy)-[:BOUGHT]->()-[:MEMBER_OF]->(nappies),
(daddy)-[:BOUGHT]->()-[:MEMBER_OF]->(beer),
(daddy)-[b:BOUGHT]->()-[:MEMBER_OF]->(console)
WHERE b is null
Full	
  Cypher	
  query	
  
START beer=node:categories(category=‘beer’),
nappies=node:categories(category=‘nappies’),
xbox=node:products(product=‘xbox 360’)
MATCH (daddy)-[:BOUGHT]->()-[:MEMBER_OF]->(beer),
(daddy)-[:BOUGHT]->()-[:MEMBER_OF]->(nappies),
(daddy)-[b?:BOUGHT]->(xbox)
WHERE b is null
RETURN distinct daddy
Results	
  
==> +---------------------------------------------+
==> | daddy |
==> +---------------------------------------------+
==> | Node[15]{name:"Rory Williams",dob:19880121} |
==> +---------------------------------------------+
==> 1 row
==> 0 ms
==>
neo4j-sh (0)$
Facebook	
  Graph	
  Search	
  
Which	
  sushi	
  restaurants	
  in	
  
NYC	
  do	
  my	
  friends	
  like?	
  
Graph	
  Structure	
  
Cypher	
  query	
  
START me=node:person(name = 'Jim'),
location=node:location(location='New York'),
cuisine=node:cuisine(cuisine='Sushi')
MATCH (me)-[:IS_FRIEND_OF]->(friend)-[:LIKES]->(restaurant)
-[:LOCATED_IN]->(location),(restaurant)-[:SERVES]->(cuisine)
RETURN restaurant
Search	
  structure	
  
What	
  are	
  graphs	
  good	
  for?	
  
•  Recommenda?ons	
  
•  Pharmacology	
  
•  Business	
  intelligence	
  
•  Social	
  compu?ng	
  
•  Geospa?al	
  
•  MDM	
  
•  Data	
  center	
  management	
  
•  Web	
  of	
  things	
  
•  Genealogy	
  
•  Time	
  series	
  data	
  
•  Product	
  catalogue	
  
•  Web	
  analy?cs	
  
•  Scien?fic	
  compu?ng	
  	
  
•  Indexing	
  your	
  slow	
  RDBMS	
  
•  And	
  much	
  more!	
  
Free	
  O’Reilly	
  book	
  for	
  
everyone!	
  
h%p://graphdatabases.com	
  
Ian Robinson,
Jim Webber & Emil Eifrem
Graph
Databases
h Com
plim
ents
ofNeo
Technology
Thanks	
  for	
  listening	
  
Neo4j:	
  h"p://neo4j.org	
  
Me:	
  @jimwebber	
  
Watch the video with slide synchronization on
InfoQ.com!
http://www.infoq.com/presentations/graph-
database-theory

Contenu connexe

Plus de C4Media

Does Java Need Inline Types? What Project Valhalla Can Bring to Java
Does Java Need Inline Types? What Project Valhalla Can Bring to JavaDoes Java Need Inline Types? What Project Valhalla Can Bring to Java
Does Java Need Inline Types? What Project Valhalla Can Bring to JavaC4Media
 
Service Meshes- The Ultimate Guide
Service Meshes- The Ultimate GuideService Meshes- The Ultimate Guide
Service Meshes- The Ultimate GuideC4Media
 
Shifting Left with Cloud Native CI/CD
Shifting Left with Cloud Native CI/CDShifting Left with Cloud Native CI/CD
Shifting Left with Cloud Native CI/CDC4Media
 
CI/CD for Machine Learning
CI/CD for Machine LearningCI/CD for Machine Learning
CI/CD for Machine LearningC4Media
 
Fault Tolerance at Speed
Fault Tolerance at SpeedFault Tolerance at Speed
Fault Tolerance at SpeedC4Media
 
Architectures That Scale Deep - Regaining Control in Deep Systems
Architectures That Scale Deep - Regaining Control in Deep SystemsArchitectures That Scale Deep - Regaining Control in Deep Systems
Architectures That Scale Deep - Regaining Control in Deep SystemsC4Media
 
ML in the Browser: Interactive Experiences with Tensorflow.js
ML in the Browser: Interactive Experiences with Tensorflow.jsML in the Browser: Interactive Experiences with Tensorflow.js
ML in the Browser: Interactive Experiences with Tensorflow.jsC4Media
 
Build Your Own WebAssembly Compiler
Build Your Own WebAssembly CompilerBuild Your Own WebAssembly Compiler
Build Your Own WebAssembly CompilerC4Media
 
User & Device Identity for Microservices @ Netflix Scale
User & Device Identity for Microservices @ Netflix ScaleUser & Device Identity for Microservices @ Netflix Scale
User & Device Identity for Microservices @ Netflix ScaleC4Media
 
Scaling Patterns for Netflix's Edge
Scaling Patterns for Netflix's EdgeScaling Patterns for Netflix's Edge
Scaling Patterns for Netflix's EdgeC4Media
 
Make Your Electron App Feel at Home Everywhere
Make Your Electron App Feel at Home EverywhereMake Your Electron App Feel at Home Everywhere
Make Your Electron App Feel at Home EverywhereC4Media
 
The Talk You've Been Await-ing For
The Talk You've Been Await-ing ForThe Talk You've Been Await-ing For
The Talk You've Been Await-ing ForC4Media
 
Future of Data Engineering
Future of Data EngineeringFuture of Data Engineering
Future of Data EngineeringC4Media
 
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and MoreAutomated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and MoreC4Media
 
Navigating Complexity: High-performance Delivery and Discovery Teams
Navigating Complexity: High-performance Delivery and Discovery TeamsNavigating Complexity: High-performance Delivery and Discovery Teams
Navigating Complexity: High-performance Delivery and Discovery TeamsC4Media
 
High Performance Cooperative Distributed Systems in Adtech
High Performance Cooperative Distributed Systems in AdtechHigh Performance Cooperative Distributed Systems in Adtech
High Performance Cooperative Distributed Systems in AdtechC4Media
 
Rust's Journey to Async/await
Rust's Journey to Async/awaitRust's Journey to Async/await
Rust's Journey to Async/awaitC4Media
 
Opportunities and Pitfalls of Event-Driven Utopia
Opportunities and Pitfalls of Event-Driven UtopiaOpportunities and Pitfalls of Event-Driven Utopia
Opportunities and Pitfalls of Event-Driven UtopiaC4Media
 
Datadog: a Real-Time Metrics Database for One Quadrillion Points/Day
Datadog: a Real-Time Metrics Database for One Quadrillion Points/DayDatadog: a Real-Time Metrics Database for One Quadrillion Points/Day
Datadog: a Real-Time Metrics Database for One Quadrillion Points/DayC4Media
 
Are We Really Cloud-Native?
Are We Really Cloud-Native?Are We Really Cloud-Native?
Are We Really Cloud-Native?C4Media
 

Plus de C4Media (20)

Does Java Need Inline Types? What Project Valhalla Can Bring to Java
Does Java Need Inline Types? What Project Valhalla Can Bring to JavaDoes Java Need Inline Types? What Project Valhalla Can Bring to Java
Does Java Need Inline Types? What Project Valhalla Can Bring to Java
 
Service Meshes- The Ultimate Guide
Service Meshes- The Ultimate GuideService Meshes- The Ultimate Guide
Service Meshes- The Ultimate Guide
 
Shifting Left with Cloud Native CI/CD
Shifting Left with Cloud Native CI/CDShifting Left with Cloud Native CI/CD
Shifting Left with Cloud Native CI/CD
 
CI/CD for Machine Learning
CI/CD for Machine LearningCI/CD for Machine Learning
CI/CD for Machine Learning
 
Fault Tolerance at Speed
Fault Tolerance at SpeedFault Tolerance at Speed
Fault Tolerance at Speed
 
Architectures That Scale Deep - Regaining Control in Deep Systems
Architectures That Scale Deep - Regaining Control in Deep SystemsArchitectures That Scale Deep - Regaining Control in Deep Systems
Architectures That Scale Deep - Regaining Control in Deep Systems
 
ML in the Browser: Interactive Experiences with Tensorflow.js
ML in the Browser: Interactive Experiences with Tensorflow.jsML in the Browser: Interactive Experiences with Tensorflow.js
ML in the Browser: Interactive Experiences with Tensorflow.js
 
Build Your Own WebAssembly Compiler
Build Your Own WebAssembly CompilerBuild Your Own WebAssembly Compiler
Build Your Own WebAssembly Compiler
 
User & Device Identity for Microservices @ Netflix Scale
User & Device Identity for Microservices @ Netflix ScaleUser & Device Identity for Microservices @ Netflix Scale
User & Device Identity for Microservices @ Netflix Scale
 
Scaling Patterns for Netflix's Edge
Scaling Patterns for Netflix's EdgeScaling Patterns for Netflix's Edge
Scaling Patterns for Netflix's Edge
 
Make Your Electron App Feel at Home Everywhere
Make Your Electron App Feel at Home EverywhereMake Your Electron App Feel at Home Everywhere
Make Your Electron App Feel at Home Everywhere
 
The Talk You've Been Await-ing For
The Talk You've Been Await-ing ForThe Talk You've Been Await-ing For
The Talk You've Been Await-ing For
 
Future of Data Engineering
Future of Data EngineeringFuture of Data Engineering
Future of Data Engineering
 
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and MoreAutomated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More
 
Navigating Complexity: High-performance Delivery and Discovery Teams
Navigating Complexity: High-performance Delivery and Discovery TeamsNavigating Complexity: High-performance Delivery and Discovery Teams
Navigating Complexity: High-performance Delivery and Discovery Teams
 
High Performance Cooperative Distributed Systems in Adtech
High Performance Cooperative Distributed Systems in AdtechHigh Performance Cooperative Distributed Systems in Adtech
High Performance Cooperative Distributed Systems in Adtech
 
Rust's Journey to Async/await
Rust's Journey to Async/awaitRust's Journey to Async/await
Rust's Journey to Async/await
 
Opportunities and Pitfalls of Event-Driven Utopia
Opportunities and Pitfalls of Event-Driven UtopiaOpportunities and Pitfalls of Event-Driven Utopia
Opportunities and Pitfalls of Event-Driven Utopia
 
Datadog: a Real-Time Metrics Database for One Quadrillion Points/Day
Datadog: a Real-Time Metrics Database for One Quadrillion Points/DayDatadog: a Real-Time Metrics Database for One Quadrillion Points/Day
Datadog: a Real-Time Metrics Database for One Quadrillion Points/Day
 
Are We Really Cloud-Native?
Are We Really Cloud-Native?Are We Really Cloud-Native?
Are We Really Cloud-Native?
 

Dernier

Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 

Dernier (20)

Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 

A Little Graph Theory for the Busy Developer

  • 1. A  Li%le  Graph  Theory  for  the   Busy  Developer   Jim  Webber   Chief  Scien?st,  Neo  Technology   @jimwebber  
  • 2. InfoQ.com: News & Community Site • 750,000 unique visitors/month • Published in 4 languages (English, Chinese, Japanese and Brazilian Portuguese) • Post content from our QCon conferences • News 15-20 / week • Articles 3-4 / week • Presentations (videos) 12-15 / week • Interviews 2-3 / week • Books 1 / month Watch the video with slide synchronization on InfoQ.com! http://www.infoq.com/presentations /graph-database-theory
  • 3. Presented at QCon New York www.qconnewyork.com Purpose of QCon - to empower software development by facilitating the spread of knowledge and innovation Strategy - practitioner-driven conference designed for YOU: influencers of change and innovation in your teams - speakers and topics driving the evolution and innovation - connecting and catalyzing the influencers and innovators Highlights - attended by more than 12,000 delegates since 2007 - held in 9 cities worldwide
  • 4. Roadmap   •  Imprisoned  data   •  Graph  models   •  Graph  theory   – Local  proper?es,  global  behaviors   – Predic?ve  techniques   •  Graph  matching   – Real-­‐?me  analy?cs  for  fun  and  profit   •  Fin  
  • 5.
  • 8.
  • 9. Aggregate-­‐Oriented  Data   h%p://mar?nfowler.com/bliki/AggregateOrientedDatabase.html   “There is a significant downside - the whole approach works really well when data access is aligned with the aggregates, but what if you want to look at the data in a different way? Order entry naturally stores orders as aggregates, but analyzing product sales cuts across the aggregate structure. The advantage of not using an aggregate structure in the database is that it allows you to slice and dice your data different ways for different audiences. This is why aggregate-oriented stores talk so much about map-reduce.”
  • 10.
  • 11. complexity = f(size, connectedness, uniformity)
  • 12.
  • 14. Property  graphs   •  Property  graph  model:   – Nodes  with  proper?es   – Named,  directed  rela?onships  with  proper?es   – Rela?onships  have  exactly  one  start  and  end  node   •  Which  may  be  the  same  node  
  • 15. stole   from   loves   loves   enemy   enemy   A  Good  Man   Goes  to  War   appeared     in   appeared     in   appeared     in   appeared     in   Victory  of     the  Daleks   appeared     in   appeared     in   companion   companion   enemy  
  • 16. Property  graphs  are  very  whiteboard-­‐friendly  
  • 18. h%p://en.wikipedia.org/wiki/File:Leonhard_Euler_2.jpg   Meet  Leonhard  Euler   •  Swiss  mathema?cian   •  Inventor  of  Graph   Theory  (1736)   16  
  • 20. A   B   D   C  
  • 21. A   B   D   C   1" 2" 3" 4" 7" 6" 5"
  • 23.
  • 24. Triadic  Closure   name: Kyle name: Stan name: Kenny
  • 25. Triadic  Closure   name: Kyle name: Stan name: Kenny name: Kyle name: Stan name: Kenny FRIEND
  • 26. Structural  Balance   name: Cartman name: Craig name: Tweek
  • 27. Structural  Balance   name: Cartman name: Craig name: Tweek name: Cartman name: Craig name: Tweek FRIEND
  • 28. Structural  Balance   name: Cartman name: Craig name: Tweek name: Cartman name: Craig name: Tweek ENEMY
  • 29. Structural  Balance   name: Kyle name: Stan name: Kenny name: Kyle name: Stan name: Kenny FRIEND
  • 30. Structural  Balance  is  a  key   predic?ve  technique   And  it’s  domain-­‐agnos?c  
  • 31. Allies  and  Enemies   UK   Germany  France   Russia   Italy   Austria  
  • 32. Allies  and  Enemies   UK   Germany  France   Russia   Italy   Austria  
  • 33. Allies  and  Enemies   UK   Germany  France   Russia   Italy   Austria  
  • 34. Allies  and  Enemies   UK   Germany  France   Russia   Italy   Austria  
  • 35. Allies  and  Enemies   UK   Germany  France   Russia   Italy   Austria  
  • 36. Allies  and  Enemies   UK   Germany  France   Russia   Italy   Austria  
  • 37. Predic?ng  WWI    [Easley  and  Kleinberg]  
  • 38. Strong  Triadic  Closure   It  if  a  node  has  strong  rela3onships  to  two   neighbours,  then  these  neighbours  must  have  at   least  a  weak  rela3onship  between  them.     [Wikipedia]  
  • 39. Triadic  Closure   (weak  rela?onship)   name: Kenny name: Stan name: Cartman
  • 40. Triadic  Closure   (weak  rela?onship)   name: Kenny name: Stan name: Cartman name: Kenny name: Stan name: Cartman FRIEND 50%
  • 41. Weak  rela?onships   •  Rela?onships  can  have  “strength”  as  well  as   intent   – Think:  weigh?ng  on  a  rela?onship  in  a  property   graph   •  Weak  links  play  another  super-­‐important   structural  role  in  graph  theory   – They  bridge  neighbourhoods  
  • 42. Local  Bridges   FRIEND name: Kenny name: Stanname: Kyle FRIENDFRIEND FRIEND name: Sally name: Bebename: Wendy FRIENDFRIEND FRIEND 50% name: Cartman FRIEND ENEMY
  • 43. Local  Bridge  Property   “If  a  node  A  in  a  network  sa3sfies  the  Strong   Triadic  Closure  Property  and  is  involved  in  at   least  two  strong  rela3onships,  then  any  local   bridge  it  is  involved  in  must  be  a  weak   rela3onship.”     [Easley  and  Kleinberg]  
  • 45. Graph  Par??oning   •  (NP)  Hard  problem   – Recursively  remove  the  spanning  links  between   dense  regions   – Or  recursively  merge  nodes  into  ever  larger   “subgraph”  nodes   – Choose  your  algorithm  carefully  –  some  are  be%er   than  others  for  a  given  domain   •  Can  use  to  (almost  exactly)  predict  the   break  up  of  the  karate  club!  
  • 46. University  Karate  Clubs   (predicted  by  Graph  Theory)   9
  • 47. University  Karate  Clubs   (what  actually  happened!)  
  • 48.
  • 49. Cypher   •  Declara?ve  graph  pa%ern  matching  language   – “SQL  for  graphs”   – Columnar  results   •  Supports  graph  matching  commands  and   queries   – Find  me  stuff  like  this…   – Aggrega?on,  ordering  and  limit,  etc.  
  • 50.
  • 51. Firstname: Mickey Surname: Smith DoB: 19781006 SKU: 5e175641 Product: Badgers Nadgers Ale SKU: 2555f258 Product: Peewee Pilsner Category: beer SKU: 49d102bc Product: Baby Dry Nights Category: nappies Category: baby Category: alcoholic drinks SKU: 49d102bc Product: XBox 360 Category: consumer electronics Category: console BOUGHTBOUGHT MEMBER_OF MEMBER_OFMEMBER_OF MEMBER_OFMEMBER_OF
  • 52.
  • 53. Firstname: * Surname: * DoB: 1996 > x > 1972 Category: beerCategory: nappies BOUGHTCategory: game console
  • 54. Firstname: * Surname: * DoB: 1996 > x > 1972 Category: beerCategory: nappies !BOUGHTCategory: game console
  • 56. Fla%en  the  graph   (daddy)-[:BOUGHT]->()-[:MEMBER_OF]->(nappies) (daddy)-[:BOUGHT]->()-[:MEMBER_OF]->(beer) (daddy)-[b:BOUGHT]->()-[:MEMBER_OF]->(console)
  • 57. Wrap  in  a  Cypher  MATCH  clause   MATCH (daddy)-[:BOUGHT]->()-[:MEMBER_OF]->(nappies), (daddy)-[:BOUGHT]->()-[:MEMBER_OF]->(beer), (daddy)-[b:BOUGHT]->()-[:MEMBER_OF]->(console)
  • 58. Cypher  WHERE  clause   MATCH (daddy)-[:BOUGHT]->()-[:MEMBER_OF]->(nappies), (daddy)-[:BOUGHT]->()-[:MEMBER_OF]->(beer), (daddy)-[b:BOUGHT]->()-[:MEMBER_OF]->(console) WHERE b is null
  • 59. Full  Cypher  query   START beer=node:categories(category=‘beer’), nappies=node:categories(category=‘nappies’), xbox=node:products(product=‘xbox 360’) MATCH (daddy)-[:BOUGHT]->()-[:MEMBER_OF]->(beer), (daddy)-[:BOUGHT]->()-[:MEMBER_OF]->(nappies), (daddy)-[b?:BOUGHT]->(xbox) WHERE b is null RETURN distinct daddy
  • 60. Results   ==> +---------------------------------------------+ ==> | daddy | ==> +---------------------------------------------+ ==> | Node[15]{name:"Rory Williams",dob:19880121} | ==> +---------------------------------------------+ ==> 1 row ==> 0 ms ==> neo4j-sh (0)$
  • 61.
  • 62. Facebook  Graph  Search   Which  sushi  restaurants  in   NYC  do  my  friends  like?  
  • 64. Cypher  query   START me=node:person(name = 'Jim'), location=node:location(location='New York'), cuisine=node:cuisine(cuisine='Sushi') MATCH (me)-[:IS_FRIEND_OF]->(friend)-[:LIKES]->(restaurant) -[:LOCATED_IN]->(location),(restaurant)-[:SERVES]->(cuisine) RETURN restaurant
  • 66.
  • 67. What  are  graphs  good  for?   •  Recommenda?ons   •  Pharmacology   •  Business  intelligence   •  Social  compu?ng   •  Geospa?al   •  MDM   •  Data  center  management   •  Web  of  things   •  Genealogy   •  Time  series  data   •  Product  catalogue   •  Web  analy?cs   •  Scien?fic  compu?ng     •  Indexing  your  slow  RDBMS   •  And  much  more!  
  • 68. Free  O’Reilly  book  for   everyone!   h%p://graphdatabases.com   Ian Robinson, Jim Webber & Emil Eifrem Graph Databases h Com plim ents ofNeo Technology
  • 69. Thanks  for  listening   Neo4j:  h"p://neo4j.org   Me:  @jimwebber  
  • 70. Watch the video with slide synchronization on InfoQ.com! http://www.infoq.com/presentations/graph- database-theory