Your SlideShare is downloading. ×
A Little Graph Theory for the Busy Developer
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

A Little Graph Theory for the Busy Developer

431

Published on

Video and slides synchronized, mp3 and slide download available at URL http://bit.ly/1fUoxRC. …

Video and slides synchronized, mp3 and slide download available at URL http://bit.ly/1fUoxRC.

Jim Webber explores analytic techniques for graph data, discussing innate properties of (social) graphs from fields like anthropology and sociology. By understanding the forces and tensions within the graph structure and applying some graph theory, we'll be able to predict how the graph will evolve over time. Filmed at qconnewyork.com.

Dr. Jim Webber is Chief Scientist with Neo Technology the company behind the popular open source graph database Neo4j, where he works on graph database server technology and writes open source software. Jim is interested in using big graphs like the Web for building distributed systems, which led him to being a co-author on the book REST in Practice.

Published in: Technology, Education
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
431
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 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. h%p://www.flickr.com/photos/crazyneighborlady/355232758/  
  • 6. h%p://gallery.nen.gov.uk/image82582-­‐.html  
  • 7. 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.”
  • 8. complexity = f(size, connectedness, uniformity)
  • 9. h%p://www.bbc.co.uk/london/travel/downloads/tube_map.html  
  • 10. 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  
  • 11. 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  
  • 12. Property  graphs  are  very  whiteboard-­‐friendly  
  • 13. h%p://blogs.adobe.com/digitalmarke?ng/analy?cs/predic?ve-­‐analy?cs/predic?ve-­‐analy?cs-­‐and-­‐the-­‐digital-­‐marketer/  
  • 14. h%p://en.wikipedia.org/wiki/File:Leonhard_Euler_2.jpg   Meet  Leonhard  Euler   •  Swiss  mathema?cian   •  Inventor  of  Graph   Theory  (1736)   16  
  • 15. Königsberg  (Prussia)  -­‐  1736  
  • 16. A   B   D   C  
  • 17. A   B   D   C   1" 2" 3" 4" 7" 6" 5"
  • 18. h%p://en.wikipedia.org/wiki/Seven_Bridges_of_Königsberg   20  
  • 19. Triadic  Closure   name: Kyle name: Stan name: Kenny
  • 20. Triadic  Closure   name: Kyle name: Stan name: Kenny name: Kyle name: Stan name: Kenny FRIEND
  • 21. Structural  Balance   name: Cartman name: Craig name: Tweek
  • 22. Structural  Balance   name: Cartman name: Craig name: Tweek name: Cartman name: Craig name: Tweek FRIEND
  • 23. Structural  Balance   name: Cartman name: Craig name: Tweek name: Cartman name: Craig name: Tweek ENEMY
  • 24. Structural  Balance   name: Kyle name: Stan name: Kenny name: Kyle name: Stan name: Kenny FRIEND
  • 25. Structural  Balance  is  a  key   predic?ve  technique   And  it’s  domain-­‐agnos?c  
  • 26. Allies  and  Enemies   UK   Germany  France   Russia   Italy   Austria  
  • 27. Allies  and  Enemies   UK   Germany  France   Russia   Italy   Austria  
  • 28. Allies  and  Enemies   UK   Germany  France   Russia   Italy   Austria  
  • 29. Allies  and  Enemies   UK   Germany  France   Russia   Italy   Austria  
  • 30. Allies  and  Enemies   UK   Germany  France   Russia   Italy   Austria  
  • 31. Allies  and  Enemies   UK   Germany  France   Russia   Italy   Austria  
  • 32. Predic?ng  WWI    [Easley  and  Kleinberg]  
  • 33. 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]  
  • 34. Triadic  Closure   (weak  rela?onship)   name: Kenny name: Stan name: Cartman
  • 35. Triadic  Closure   (weak  rela?onship)   name: Kenny name: Stan name: Cartman name: Kenny name: Stan name: Cartman FRIEND 50%
  • 36. 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  
  • 37. Local  Bridges   FRIEND name: Kenny name: Stanname: Kyle FRIENDFRIEND FRIEND name: Sally name: Bebename: Wendy FRIENDFRIEND FRIEND 50% name: Cartman FRIEND ENEMY
  • 38. 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]  
  • 39. University  Karate  Club  
  • 40. 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!  
  • 41. University  Karate  Clubs   (predicted  by  Graph  Theory)   9
  • 42. University  Karate  Clubs   (what  actually  happened!)  
  • 43. 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.  
  • 44. 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
  • 45. Firstname: * Surname: * DoB: 1996 > x > 1972 Category: beerCategory: nappies BOUGHTCategory: game console
  • 46. Firstname: * Surname: * DoB: 1996 > x > 1972 Category: beerCategory: nappies !BOUGHTCategory: game console
  • 47. (beer)(nappies) (console) (daddy) () () <-[b:BOUGHT]-()
  • 48. Fla%en  the  graph   (daddy)-[:BOUGHT]->()-[:MEMBER_OF]->(nappies) (daddy)-[:BOUGHT]->()-[:MEMBER_OF]->(beer) (daddy)-[b:BOUGHT]->()-[:MEMBER_OF]->(console)
  • 49. Wrap  in  a  Cypher  MATCH  clause   MATCH (daddy)-[:BOUGHT]->()-[:MEMBER_OF]->(nappies), (daddy)-[:BOUGHT]->()-[:MEMBER_OF]->(beer), (daddy)-[b:BOUGHT]->()-[:MEMBER_OF]->(console)
  • 50. Cypher  WHERE  clause   MATCH (daddy)-[:BOUGHT]->()-[:MEMBER_OF]->(nappies), (daddy)-[:BOUGHT]->()-[:MEMBER_OF]->(beer), (daddy)-[b:BOUGHT]->()-[:MEMBER_OF]->(console) WHERE b is null
  • 51. 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
  • 52. Results   ==> +---------------------------------------------+ ==> | daddy | ==> +---------------------------------------------+ ==> | Node[15]{name:"Rory Williams",dob:19880121} | ==> +---------------------------------------------+ ==> 1 row ==> 0 ms ==> neo4j-sh (0)$
  • 53. Facebook  Graph  Search   Which  sushi  restaurants  in   NYC  do  my  friends  like?  
  • 54. Graph  Structure  
  • 55. 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
  • 56. Search  structure  
  • 57. 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!  
  • 58. Free  O’Reilly  book  for   everyone!   h%p://graphdatabases.com   Ian Robinson, Jim Webber & Emil Eifrem Graph Databases h Com plim ents ofNeo Technology
  • 59. Thanks  for  listening   Neo4j:  h"p://neo4j.org   Me:  @jimwebber  
  • 60. Watch the video with slide synchronization on InfoQ.com! http://www.infoq.com/presentations/graph- database-theory

×