Transcript
Page 1: The 5 Graphs of Love

�1

Amanda Laucher Neo Technology @pandamonial

(Neo4j)-[:POWERS] ->(Love)

Page 2: The 5 Graphs of Love

�2

Most of your favorite dating sites

Page 3: The 5 Graphs of Love

�3

The 5 Graphs of Love

Page 4: The 5 Graphs of Love

�4

The 5 Graphs of Love

• The Friends-of-Friends Graph

!

!

!

!

!

!

!

Page 5: The 5 Graphs of Love

�5

The 5 Graphs of Love

• The Friends-of-Friends Graph

!

• The Passion Graph

!

!

!

!

!

Page 6: The 5 Graphs of Love

�6

The 5 Graphs of Love

• The Friends-of-Friends Graph

!

• The Passion Graph

!

• The Location Graph

!

!

!

Page 7: The 5 Graphs of Love

�7

The 5 Graphs of Love

• The Friends-of-Friends Graph

!

• The Passion Graph

!

• The Location Graph

!

• The Safety Graph

!

Page 8: The 5 Graphs of Love

�8

The 5 Graphs of Love

• The Friends-of-Friends Graph

!

• The Passion Graph

!

• The Location Graph

!

• The Safety Graph

!

• The Poser Graph

Page 9: The 5 Graphs of Love

๏from: California

๏appearance: very handsome

๏personality: super friendly nerd

๏interests: piano, coding

Meet Jeremy...

Jeremy

Page 10: The 5 Graphs of Love

๏Kerstin: his sister

๏Peter: his buddy

๏Andreas: his coworker

Jeremy has some friends

KerstinAndreas

JeremyPeter

Page 11: The 5 Graphs of Love

๏Michael: master hacker, divorced, 2 kids

๏Johan: technology sage, likes fast cars

๏Madelene: polyglot journalist, loves dogs

๏Allison: marketing maven, likes long walks on the beach

His friends introduced more friends

Johan

Kerstin

Allison

Andreas

Michael

Madelene

JeremyPeter

Page 12: The 5 Graphs of Love

๏how do we know they are friends?

๏either ask each pair: are you friends?

๏or, we can add explicit connections

๏Twitter, Facebook, LinkedIn, etc.

So, we have a bunch of people

Johan

Kerstin

Allison

Andreas

Michael

Madelene

JeremyPeter

Page 13: The 5 Graphs of Love

๏it's just a graph

This is really just data

Johan

Kerstin

Allison

AnnaAdamAndreas

Michael

Madelene

JeremyPeter

Page 14: The 5 Graphs of Love

�14

A graph?

Page 15: The 5 Graphs of Love

Yes, a graph...

�15

๏you know the common data structures

•linked lists, trees, object "graphs"

๏a graph is the general purpose data structure

•suitable for any connected data

๏well-understood patterns and algorithms

•studied since Leonard Euler's 7 Bridges (1736)

•Codd's Relational Model (1970)

•not a new idea, just an idea who's time is now

Page 16: The 5 Graphs of Love

�16

How can you use this? With a Graph Database

Page 17: The 5 Graphs of Love

A graph database...

�17

๏optimized for the connections between records

๏really, really fast at querying across records

๏a database: transactional with the usual operations

๏“A relational database may tell you the average age of everyone here,

but a graph database will tell you who is most likely to buy you a beer later.”

Page 18: The 5 Graphs of Love

What’s love got to do with it?

�18

Page 19: The 5 Graphs of Love

�19

Friends of Friends Graph

Page 20: The 5 Graphs of Love

!

๏4% likelihood of interacting with a stranger

๏10% likelihood of interacting with friend of friend

๏7% chance of interacting with 3rd degree connection (friend of friend of friend)

๏Connections mean a much larger number of interactions!

JeremyPeterJohan

Jennifer

Allison

AnnaAdamAndreas

Michael

Madelene

According to SNAP Interactive if you are a female user, you have a:

Page 21: The 5 Graphs of Love

�21

Friends of friends = larger dating pool

Page 22: The 5 Graphs of Love

Friends

Peter JenniferAndreasJeremy

Page 23: The 5 Graphs of Love

Friends of friends

PeterJohan

Jennifer

Allison

Andreas

Jeremy

MadeleneFrank

Amanda

Jeremy

Page 24: The 5 Graphs of Love

Friends of friends of friends

Page 25: The 5 Graphs of Love

�25

Find Jeremy’s FoFs

Page 26: The 5 Graphs of Love

�26

Demo - Find who Jeremy shares the most friends with

Page 27: The 5 Graphs of Love

JakePeter JenniferAndreas

:WORKS_FOR:FRIENDS:FRIENDS

Complicated Relationships

Page 28: The 5 Graphs of Love

:WANTS_TO_DATE

JakePeter JenniferAndreas

:WORKS_FOR:FRIENDS:FRIENDS

Friends

Page 29: The 5 Graphs of Love

Awkward!!

JakePeter JenniferAndreas

:WORKS_FOR:FRIENDS:FRIENDS

Friends

:WANTS_TO_DATE

Page 30: The 5 Graphs of Love

:WANTS_TO_DATE

Awkward

:WANTS_TO_DATE

JakePeter JenniferAndreas

:WORKS_FOR:FRIENDS:FRIENDS

Friends of Friends

Page 31: The 5 Graphs of Love

:WANTS_TO_DATE

:WANTS_TO_DATE

JakePeter JenniferAndreas

:WORKS_FOR:FRIENDS:FRIENDS

:NO_DATE

Too complex!

Friends of Friends

Page 32: The 5 Graphs of Love

Friends of Friends of Friends

:WANTS_TO_DATE :WANTS_TO_DATE

JakePeter JenniferAndreas

:WORKS_FOR:FRIENDS:FRIENDS

:NO_DATE

:NO_DATE

:WANTS_TO_DATE

:WANTS_TO_DATE

Page 33: The 5 Graphs of Love

Friends of Friends of Friends

Page 34: The 5 Graphs of Love

Friends of Friends of Friends

Page 35: The 5 Graphs of Love

๏from: UK

๏seeking: Females

๏appearance: Hot, hot, hot!

๏personality: Fun loving, easy going

๏interests: cooking, chemistry

Jon

Meet Jon...

Page 36: The 5 Graphs of Love

�36

Location Graph

Page 37: The 5 Graphs of Love

Jon wants to find a date and refuses to have a long distance relationship

�37

Page 38: The 5 Graphs of Love

�38

Location Graph*Neo4j Spatial

Page 39: The 5 Graphs of Love

�39

Passion Graph

Page 40: The 5 Graphs of Love

Jon wants to find someone he can share his passions

with.

�40

Page 41: The 5 Graphs of Love

Jon

:REPORTED_INTEREST

Match Specific Interests

Cooking

Page 42: The 5 Graphs of Love

Jon

:REPORTED_INTEREST

Match Specific Interests

Page 43: The 5 Graphs of Love

Jon

:REPORTED_INTEREST

JenniferAnne Julia

Match Specific Interests

Page 44: The 5 Graphs of Love

�44

Safety Graph

Page 45: The 5 Graphs of Love

Jon uses social networks

Jon

Page 46: The 5 Graphs of Love

Let’s dig into his Twitter

Page 47: The 5 Graphs of Love

He follows some strange people

Page 48: The 5 Graphs of Love

…and tweets about strange things!

Page 49: The 5 Graphs of Love

Some basic word analysis

Page 50: The 5 Graphs of Love

Let’s update based on behavior

:DEMONSTRATED_INTEREST

Jon

Page 51: The 5 Graphs of Love

Any ladies ok with this?

Page 52: The 5 Graphs of Love

Jennifer Jane Maria

Any ladies ok with this?

Page 53: The 5 Graphs of Love

�53

Passion Graph

Page 54: The 5 Graphs of Love

Jon loves the New England Patriots

�54

Jon:HAS_INTEREST

Page 55: The 5 Graphs of Love

�55

Sports

:IS_A

:IS_A

:IS_A:IS_A

Page 56: The 5 Graphs of Love

�56

Sports

:HAS_TEAM

:HAS_TEAM

:HAS_TEAM

:HAS_TEAM

:HAS_TEAM

:IS_A:IS_A

:IS_A

:IS_A

Page 57: The 5 Graphs of Love

�57

Sports

:HAS_TEAM

:HAS_TEAM

:HAS_TEAM

:HAS_TEAM

:HAS_TEAM

:IS_A:IS_A

:IS_A

:IS_A

Jon

Page 58: The 5 Graphs of Love

�58

Sports

Jon

Page 59: The 5 Graphs of Love

�59

Find ladies who like football

Page 60: The 5 Graphs of Love

�60

Jennifer Katie Greta

Find ladies who like football

Page 61: The 5 Graphs of Love

�61

Poser Graph

Page 62: The 5 Graphs of Love

Jon has no luck with online dating. All of his interactions are with

spam profiles.

�62

Page 63: The 5 Graphs of Love

Find real people with at least 1 social network & minimum 2 posts

�63

Page 64: The 5 Graphs of Love

�64

Find ladies who aren’t spam bots

Page 65: The 5 Graphs of Love

Put it all together

�65

Page 66: The 5 Graphs of Love

�66

Find Jon’s perfect date

Page 67: The 5 Graphs of Love

�67

JenniferJon:PERFECT_FOR

Page 68: The 5 Graphs of Love

�68

JenniferJon:HAS_DATE_WITH

Page 69: The 5 Graphs of Love

�69

Jon & Jennifer delete their profiles and go off into the sunset!

JenniferJon

Page 70: The 5 Graphs of Love

Jon Jennifer

Love

[:FOUND]

[:AIDS]

[:AIDS]

[:AIDS]

[:AIDS]

[:AIDS][:POWERS]

Page 71: The 5 Graphs of Love

�71

Amanda Laucher Neo Technology

(Neo4j)-[:POWERS] ->(Love)

Page 72: The 5 Graphs of Love

RDBMS/Other vs. Native Graph Database

Performance Challenges with Connected Data

Connectedness of Data Set

Resp

onse

Tim

e

RDBMS / Other NOSQL# Hops: 0-2 Degree: < 3

Size: ThousandsNeo4j

# Hops: Tens to Hundreds Degree: Thousands+ Size: Billions+

1000x faster

Page 73: The 5 Graphs of Love

Neo Technology, Inc Confidential

Core Industries & Use Cases:

Web / ISV Financial Services

Telecomm-unications

Network & Data Center Management

Master Data Management

Social

Geo

Core Industries & Use Cases: Software

Financial Services

Telecommunications

Health Care & Life Sciences

Web Social,HR & Recruiting

Media & Publishing

Energy, Services, Automotive, Gov’t, Logistics, Education,

Gaming, Other

Network & Data Center Management

MDM / System of Record

Social

Geo

Recommend-ations

Identity & Access Mgmt

Content Management

BI, CRM, Impact Analysis, Fraud Detection, Resource

Optimization, etc.

Accenture

Aviation

Neo4j Adoption SnapshotSelect Commercial Customers* (some NDA)

*Community Users Not Included

Page 74: The 5 Graphs of Love

Neo Technology, Inc Confidential

Graph Database Deployment

ApplicationOther

Databases

ETL

Graph Database Cluster

Data Storage & Business Rules Execution

Reporting

Graph- Dashboards&Ad-hocAnalysis

Graph Visualization

End User Ad-hoc visual navigation & discovery

Bulk Analytic Infrastructure

(e.g. Graph Compute Engine)

ETL

Graph Mining & Aggregation

Data Scientist

Ad-HocAnalysis

Page 75: The 5 Graphs of Love

*“Find all direct reports and how many they manage, up to 3 levels down”

(SELECT T.directReportees AS directReportees, sum(T.count) AS count FROM ( SELECT manager.pid AS directReportees, 0 AS count FROM person_reportee manager WHERE manager.pid = (SELECT id FROM person WHERE name = "fName lName") UNION SELECT manager.pid AS directReportees, count(manager.directly_manages) AS count FROM person_reportee manager WHERE manager.pid = (SELECT id FROM person WHERE name = "fName lName") GROUP BY directReportees UNION SELECT manager.pid AS directReportees, count(reportee.directly_manages) AS count FROM person_reportee manager JOIN person_reportee reportee ON manager.directly_manages = reportee.pid WHERE manager.pid = (SELECT id FROM person WHERE name = "fName lName") GROUP BY directReportees UNION SELECT manager.pid AS directReportees, count(L2Reportees.directly_manages) AS count FROM person_reportee manager JOIN person_reportee L1Reportees ON manager.directly_manages = L1Reportees.pid JOIN person_reportee L2Reportees ON L1Reportees.directly_manages = L2Reportees.pid WHERE manager.pid = (SELECT id FROM person WHERE name = "fName lName") GROUP BY directReportees ) AS T GROUP BY directReportees) UNION (SELECT T.directReportees AS directReportees, sum(T.count) AS count FROM ( SELECT manager.directly_manages AS directReportees, 0 AS count FROM person_reportee manager WHERE manager.pid = (SELECT id FROM person WHERE name = "fName lName") UNION SELECT reportee.pid AS directReportees, count(reportee.directly_manages) AS count FROM person_reportee manager JOIN person_reportee reportee ON manager.directly_manages = reportee.pid WHERE manager.pid = (SELECT id FROM person WHERE name = "fName lName") GROUP BY directReportees UNION

(continued from previous page...) SELECT depth1Reportees.pid AS directReportees, count(depth2Reportees.directly_manages) AS count FROM person_reportee manager JOIN person_reportee L1Reportees ON manager.directly_manages = L1Reportees.pid JOIN person_reportee L2Reportees ON L1Reportees.directly_manages = L2Reportees.pid WHERE manager.pid = (SELECT id FROM person WHERE name = "fName lName") GROUP BY directReportees ) AS T GROUP BY directReportees) UNION (SELECT T.directReportees AS directReportees, sum(T.count) AS count FROM( SELECT reportee.directly_manages AS directReportees, 0 AS count FROM person_reportee manager JOIN person_reportee reportee ON manager.directly_manages = reportee.pid WHERE manager.pid = (SELECT id FROM person WHERE name = "fName lName") GROUP BY directReportees UNION SELECT L2Reportees.pid AS directReportees, count(L2Reportees.directly_manages) AS count FROM person_reportee manager JOIN person_reportee L1Reportees ON manager.directly_manages = L1Reportees.pid JOIN person_reportee L2Reportees ON L1Reportees.directly_manages = L2Reportees.pid WHERE manager.pid = (SELECT id FROM person WHERE name = "fName lName") GROUP BY directReportees ) AS T GROUP BY directReportees) UNION (SELECT L2Reportees.directly_manages AS directReportees, 0 AS count FROM person_reportee manager JOIN person_reportee L1Reportees ON manager.directly_manages = L1Reportees.pid JOIN person_reportee L2Reportees ON L1Reportees.directly_manages = L2Reportees.pid WHERE manager.pid = (SELECT id FROM person WHERE name = "fName lName") ) !

Experiencing Query Pain Actual HR Query* (in SQL)

Page 76: The 5 Graphs of Love

MATCH  (boss)-­‐[:MANAGES*0..3]-­‐>(sub),              (sub)-­‐[:MANAGES*1..3]-­‐>(report)  WHERE  boss.name  =  “John  Doe”  RETURN  sub.name  AS  Subordinate,  count(report)  AS  Total

Experiencing Query Pain Same Query*, using Cypher

*“Find all direct reports and how many they manage, up to 3 levels down”


Top Related