Graph Search: The Power of Connected Data

Preview:

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

Ian  Robinson,  Neo  Technology  

Graph  Search:  The  Power  of  Connected  Data  

Twi$er  @iansrobinson  

#neo4j  

Outline  

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

Data  Complexity  

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

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

Data  Complexity  

Semi-­‐Structure  

Semi-­‐Structure  

Email:  ian@neotechnology.com  Email:  iansrobinson@gmail.com  Twi$er:  @iansrobinson  Skype:  iansrobinson  

FIRST_NAME   LAST_NAME  USER_ID   EMAIL_1   EMAIL_2   TWITTER  FACEBOOK   SKYPE  

Ian   Robinson  315   ian@neotechnology.com   iansrobinson@gmail.com   @iansrobinson  NULL   iansrobinson  

USER  

CONTACT  

CONTACT_TYPE  

0..n  

Social  Network  

Network  Impact  Analysis  

Route  Finding  

Recommenda]ons  

Logis]cs  

Access  Control  

Fraud  Analysis  

Securi]es  and  Debt  

Image:  orgnet.com  

Graphs  Are  Everywhere  

Graph  Databases  

•  Store  •  Manage  •  Query   data  

Neo4j  is  a  Graph  Database  

Labeled  Property  Graph  

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  

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  

Querying  Graph  Data  

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

How  to  Describe  a  Graph?  

Cypher  Padern  

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

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

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  

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  

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

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

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

Cypher  Padern  

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

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

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

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  

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

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

Case  Studies  

Network  Impact  Analysis  

•  Which  parts  of  network  does  a  customer  depend  on?  

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

Asset  Management  &  Access  Control  

•  Which  assets  can  an  admin  control?  

•  Who  can  change  my  subscrip]on?  

Logis]cs  

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

Social  Network  &  Recommenda]ons  

•  Which  assets  can  I  access?  

•  Who  shares  my  interests?  

@ianSrobinson  ian@neotechnology.com  

   

Ian Robinson, Jim Webber & Emil Eifrem

Graph Databases

h

Compliments

of Neo Technology Thank  you  

graphdatabases.com  

Recommended