43
Ian Robinson, Neo Technology Graph Search: The Power of Connected Data Twi$er @iansrobinson #neo4j

Graph Search: The Power of Connected Data

  • View
    698

  • Download
    0

Embed Size (px)

DESCRIPTION

Today’s complex data is big, variably-structured and densely connected. In this session we’ll look at how size, structure and connectedness have converged to change the way we work with data. We’ll then go on to look at some of the new opportunities for creating end-user value that have emerged in a world of connected data, illustrated with graph search examples implemented using the Neo4j graph database.

Citation preview

Page 1: Graph Search: The Power of Connected Data

Ian  Robinson,  Neo  Technology  

Graph  Search:  The  Power  of  Connected  Data  

Twi$er  @iansrobinson  

#neo4j  

Page 2: Graph Search: The Power of Connected Data

Outline  

•  Data  complexity  •  Graph  databases  –  features  and  benefits  •  Querying  graph  data  

Page 3: Graph Search: The Power of Connected Data

Data  Complexity  

complexity = f(size, semi-structure, connectedness)

Page 4: Graph Search: The Power of Connected Data

complexity = f(size, semi-structure, connectedness)

Data  Complexity  

Page 5: Graph Search: The Power of Connected Data

Semi-­‐Structure  

Page 6: Graph Search: The Power of Connected Data

Semi-­‐Structure  

Email:  [email protected]  Email:  [email protected]  Twi$er:  @iansrobinson  Skype:  iansrobinson  

FIRST_NAME   LAST_NAME  USER_ID   EMAIL_1   EMAIL_2   TWITTER  FACEBOOK   SKYPE  

Ian   Robinson  315   [email protected]   [email protected]   @iansrobinson  NULL   iansrobinson  

USER  

CONTACT  

CONTACT_TYPE  

0..n  

Page 7: Graph Search: The Power of Connected Data

Social  Network  

Page 8: Graph Search: The Power of Connected Data

Network  Impact  Analysis  

Page 9: Graph Search: The Power of Connected Data

Route  Finding  

Page 10: Graph Search: The Power of Connected Data

Recommenda]ons  

Page 11: Graph Search: The Power of Connected Data

Logis]cs  

Page 12: Graph Search: The Power of Connected Data

Access  Control  

Page 13: Graph Search: The Power of Connected Data

Fraud  Analysis  

Page 14: Graph Search: The Power of Connected Data

Securi]es  and  Debt  

Image:  orgnet.com  

Page 15: Graph Search: The Power of Connected Data

Graphs  Are  Everywhere  

Page 16: Graph Search: The Power of Connected Data

Graph  Databases  

•  Store  •  Manage  •  Query   data  

Page 17: Graph Search: The Power of Connected Data

Neo4j  is  a  Graph  Database  

Page 18: Graph Search: The Power of Connected Data

Labeled  Property  Graph  

Page 19: Graph Search: The Power of Connected Data

The  Power  of  Rela]onships  Connectedness  •  Pre-­‐computed  joins    •  Several  million  joins  per  second  per  thread  per  core  

Variable  Structure  •  Defined  with  regard  to  node  instances,  not  classes  of  nodes  – Contrast  with  rela]onal  schemas,  where  foreign  key  rela]onships  apply  to  all  rows  in  a  table  

Page 20: Graph Search: The Power of Connected Data

Graph  Database  Benefits  “Minutes  to  milliseconds”  performance  •  Millions  of  ‘joins’  per  second  •  Consistent  query  ]mes  as  dataset  grows  

Fit  for  the  domain  •  Lots  of  join  tables?  Connectedness  •  Lots  of  sparse  tables?  Semi-­‐structure  

Business  responsiveness  •  Easy  to  evolve  

Page 21: Graph Search: The Power of Connected Data

Querying  Graph  Data  

•  Describing  graphs  •  Crea]ng  nodes,  rela]onships  and  proper]es  •  Querying  graphs  

Page 22: Graph Search: The Power of Connected Data

How  to  Describe  a  Graph?  

Page 23: Graph Search: The Power of Connected Data

Cypher  Padern  

(rest)<-[:HAS_SKILL]-(ben)-[:HAS_SKILL]->(neo4j),(ben)-[:WORKS_FOR]->(acme)

Page 24: Graph Search: The Power of Connected Data

Create  Some  Data  CREATE (ben:Person { name:'Ben' }), (acme:Company { name:'Acme' }), (rest:Skill { name:'REST' }), (neo4j:Skill= { name:'Neo4j' }), (ben)-[:WORKS_FOR]->(acme), (ben)-[:HAS_SKILL]->(rest), (ben)-[:HAS_SKILL]->(graphs)RETURN ben

Page 25: Graph Search: The Power of Connected Data

Create  Nodes  CREATE (ben:Person { name:'Ben' }), (acme:Company { name:'Acme' }), (rest:Skill { name:'REST' }), (neo4j:Skill= { name:'Neo4j' }), (ben)-[:WORKS_FOR]->(acme), (ben)-[:HAS_SKILL]->(rest), (ben)-[:HAS_SKILL]->(graphs)RETURN ben

Iden]fier  Label  

Proper]es  

Page 26: Graph Search: The Power of Connected Data

Create  Rela]onships  CREATE (ben:Person { name:'Ben' }), (acme:Company { name:'Acme' }), (rest:Skill { name:'REST' }), (neo4j:Skill= { name:'Neo4j' }), (ben)-[:WORKS_FOR]->(acme), (ben)-[:HAS_SKILL]->(rest), (ben)-[:HAS_SKILL]->(graphs)RETURN ben

Iden]fier  Rela]onship  

Iden]fier  

Page 27: Graph Search: The Power of Connected Data

Return  Node  CREATE (ben:Person { name:'Ben' }), (acme:Company { name:'Acme' }), (rest:Skill { name:'REST' }), (neo4j:Skill= { name:'Neo4j' }), (ben)-[:WORKS_FOR]->(acme), (ben)-[:HAS_SKILL]->(rest), (ben)-[:HAS_SKILL]->(graphs)RETURN ben

Page 28: Graph Search: The Power of Connected Data
Page 29: Graph Search: The Power of Connected Data

Querying  a  Graph  Graph  Local  •  Find  one  or  more  start  nodes  •  Explore  surrounding  graph  •  Millions  of  hops  per  second  

Page 30: Graph Search: The Power of Connected Data

Which  people,  who  work  for  the  same  company  as  me,  share  my  skills?  

Page 31: Graph Search: The Power of Connected Data

Cypher  Padern  

(company)<-[:WORKS_FOR]-(me)-[:HAS_SKILL]->(skill),(company)<-[:WORKS_FOR]-(colleague)-[:HAS_SKILL]->(skill)

Page 32: Graph Search: The Power of Connected Data

Cypher  Query  

Which  people,  who  work  for  the  same  company  as  me,  have  similar  skills  to  me?  MATCH (company)<-[:WORKS_FOR]-(me:Person)-[:HAS_SKILL]->(skill), (company)<-[:WORKS_FOR]-(colleague)-[:HAS_SKILL]->(skill)WHERE me.name = 'ian'RETURN colleague.name AS name, count(skill) AS score, collect(skill.name) AS skillsORDER BY score DESC

Page 33: Graph Search: The Power of Connected Data

Graph  Padern  

Which  people,  who  work  for  the  same  company  as  me,  have  similar  skills  to  me?  MATCH (company)<-[:WORKS_FOR]-(me:Person)-[:HAS_SKILL]->(skill), (company)<-[:WORKS_FOR]-(colleague)-[:HAS_SKILL]->(skill)WHERE me.name = 'ian'RETURN colleague.name AS name, count(skill) AS score, collect(skill.name) AS skillsORDER BY score DESC

Page 34: Graph Search: The Power of Connected Data

Which  people,  who  work  for  the  same  company  as  me,  have  similar  skills  to  me?  MATCH (company)<-[:WORKS_FOR]-(me:Person)-[:HAS_SKILL]->(skill), (company)<-[:WORKS_FOR]-(colleague)-[:HAS_SKILL]->(skill)WHERE me.name = 'ian'RETURN colleague.name AS name, count(skill) AS score, collect(skill.name) AS skillsORDER BY score DESC

Anchor  Padern  in  Graph  

Search  nodes  labelled  ‘Person’,  matching  on  

‘name’  property  

Page 35: Graph Search: The Power of Connected Data

Create  Results  

Which  people,  who  work  for  the  same  company  as  me,  have  similar  skills  to  me?  MATCH (company)<-[:WORKS_FOR]-(me:Person)-[:HAS_SKILL]->(skill), (company)<-[:WORKS_FOR]-(colleague)-[:HAS_SKILL]->(skill)WHERE me.name = 'ian'RETURN colleague.name AS name, count(skill) AS score, collect(skill.name) AS skillsORDER BY score DESC

Page 36: Graph Search: The Power of Connected Data
Page 37: Graph Search: The Power of Connected Data

Results  +--------------------------------------+| name | score | skills |+--------------------------------------+| "Ben" | 2 | ["Neo4j","REST"] || "Charlie" | 1 | ["Neo4j"] |+--------------------------------------+2 rows

Page 38: Graph Search: The Power of Connected Data

Case  Studies  

Page 39: Graph Search: The Power of Connected Data

Network  Impact  Analysis  

•  Which  parts  of  network  does  a  customer  depend  on?  

•  Who  will  be  affected  if  we  replace  a  network  element?  

Page 40: Graph Search: The Power of Connected Data

Asset  Management  &  Access  Control  

•  Which  assets  can  an  admin  control?  

•  Who  can  change  my  subscrip]on?  

Page 41: Graph Search: The Power of Connected Data

Logis]cs  

•  What’s  the  quickest  delivery  route  for  this  parcel?  

Page 42: Graph Search: The Power of Connected Data

Social  Network  &  Recommenda]ons  

•  Which  assets  can  I  access?  

•  Who  shares  my  interests?  

Page 43: Graph Search: The Power of Connected Data

@ianSrobinson  [email protected]  

   

Ian Robinson, Jim Webber & Emil Eifrem

Graph Databases

h

Compliments

of Neo Technology Thank  you  

graphdatabases.com