SlideShare a Scribd company logo
© 2022 Neo4j, Inc. All rights reserved.
© 2022 Neo4j, Inc. All rights reserved.
Graph Data Modeling Best
Practices
Eric Monk,
Principal Solutions Engineer
© 2022 Neo4j, Inc. All rights reserved.
What is a Graph Data Model?
The structure and definition of the Nodes, Relationships, and Properties.
Structure = How Labeled Nodes are connected via Relationship Types.
Definition = Labels and Relationship Types used. Assignment of Properties to
Labeled Nodes and Relationship Types along with their data types.
2
Explicit Graph Data Modeling is OPTIONAL, but very useful.
© 2022 Neo4j, Inc. All rights reserved.
Instance vs Model
3
:Person :Person
:KNOWS name: String
age: Integer
Person Node Label
KNOWS Relationship Type
alice
:Person
bob
:Person
:KNOWS name: Bob
age: 42
alice Node with
Person Node Label
KNOWS Relationship
name and age
Property Definitions
Model
name and age
Properties with values
Instance
© 2022 Neo4j, Inc. All rights reserved.
4
© 2022 Neo4j, Inc. All rights reserved.
5
We are here:
Data Modeling
© 2022 Neo4j, Inc. All rights reserved.
6
+ More Questions
+ More Queries
+ More Data
Need to harmonize
inputs from multiple
sources
We need to iterate
+ Domain Expertise
+ Performance
Concerns
© 2022 Neo4j, Inc. All rights reserved.
Types of Modeling
Whiteboard - graph domain information
Instance Model - graph example data to solve questions
Logical Model - use Node Labels and Relationship Types to define graph
structure + some Property Definition
Physical Model - augment Logical Model with Property Definitions to support
data load + constraints
Tuned Model - account for previous misconceptions and performance
concerns
7
© 2022 Neo4j, Inc. All rights reserved.
8
Types of Models
Model Type Domain
Expertise
Questions Data Load Cypher
Queries
Performance Constraints /
Indexes
Whiteboard Y Y
Instance
Model
Y Y *
Logical Model Y Y * *
Physical Model Y Y Y Y * Y
Tuned Model Y Y Y Y Y Y
* Partial support
© 2022 Neo4j, Inc. All rights reserved.
9
Types of Models
Model Type Domain
Expertise
Questions Data Load Cypher
Queries
Performance Constraints /
Indexes
Whiteboard Y Y
Instance
Model
Y Y *
Logical Model Y Y * *
Physical Model Y Y Y Y * Y
Tuned Model Y Y Y Y Y Y
* Partial support
Similar level of detail
- slightly different
approaches
© 2022 Neo4j, Inc. All rights reserved.
10
See
Draw your model
visually. Use a tool
such as Arrows to
create and view your
model.
Whiteboard Tips
Know
Use domain relevant
language. Collaborate
with domain experts to
understand the real
world processes the
data represents.
Limit
Initially limit the scope
of your model. Only
include concepts and
relationships relevant to
an initial set of
questions.
Focus on concepts and how they are related.
© 2022 Neo4j, Inc. All rights reserved.
11
Whiteboard Example
© 2022 Neo4j, Inc. All rights reserved.
12
Define
Define properties
relevant to the nodes
and relationships.
Instance Model Tips
Fill
Create example nodes
and relationships with
representative data.
Answer
Trace paths to ensure
questions can be
answered. Write
Cypher if needed.
Representative Data. Focus on answering a question.
© 2022 Neo4j, Inc. All rights reserved.
13
Instance Model Example
© 2022 Neo4j, Inc. All rights reserved.
14
Node, Relationship, or Property?
Item/Action Definition Node Relationship Property
Business noun - Y (1) Y (2)
How things relate - Y
Anchor Starting point Y (3) Y (3)
Traverse Visit matching
relationships and nodes
Y Y
Degree Count of relationships per
node
Y Y (4)
Filter Remove paths by
examining property values
Y
Decorator Return property value Y
© 2022 Neo4j, Inc. All rights reserved.
Node, Relationship, or Property? (Notes)
15
Business noun - Node
Domain concept
Unique identifier
Avoid supernodes (very high degree nodes)
Business noun - Property
Attribute of a Domain concept
Small set of possible values
Names, quantities, timestamps
Anchor
Both Node Label and Property are used to
Anchor
Degree
Used to access Neo4j count store
© 2022 Neo4j, Inc. All rights reserved.
16
Define
Define properties
relevant to the nodes
and relationships.
Logical Model Tips
Guided
Use node, relationship,
and property guidance
to decide proper graph
structure.
Answer
Trace paths to ensure
questions can be
answered. Write
Cypher if needed.
Informed Modeling. Focus on answering a question.
© 2022 Neo4j, Inc. All rights reserved.
17
Logical Model Example
© 2022 Neo4j, Inc. All rights reserved.
Data Discovery
• Identify data sources node and properties in the model
• Getting sample data
• Identify primary keys / node keys
• Can correlate across data sources?
• Does your model map to existing sources? Any gaps?
18
© 2022 Neo4j, Inc. All rights reserved.
19
Source
Use details from
relevant data sources
to inform your
modeling.
Physical Model Tips
Keys
Determine node keys,
constraints, and
indexes to prepare for
data load.
Load
Load data. Confirm
structures are loaded
properly and data types
are correct.
Enable loading of data. Question(s) should still be answered.
© 2022 Neo4j, Inc. All rights reserved.
20
Physical Model Example
© 2022 Neo4j, Inc. All rights reserved.
21
Iterate
Make adjustments as
needed to tune model
based on additional
data added or new
questions to be
answered.
Tuning Your Model
Performance
Use specific
Relationship Types to
assist traversals.
Ensure constraints and
indexes are used
properly.
Validate
Validate the model to
ensure data is loaded
properly, questions are
answered.
Focus on optimizing the model.
© 2022 Neo4j, Inc. All rights reserved.
22
Relationship Types Example
© 2022 Neo4j, Inc. All rights reserved.
23
images by OokamiKasumi and TransparentJiggly64
https://www.deviantart.com/ookamikasumi/art/Many-Doors-to-Wonderland-166917185 https://www.deviantart.com/transparentjiggly64/art/Champion-Link-Facing-Away-803623424
Room
Imagine a room with
many doors.
Room = node
Door = relationship
© 2022 Neo4j, Inc. All rights reserved.
Room
24
Treasure
Our adventurer
wants treasure.
© 2022 Neo4j, Inc. All rights reserved.
Room
25
PATH_TO
PATH_TO
PATH_TO
PATH_TO
PATH_TO
???
Treasure
Uhh…which way to
go?
© 2022 Neo4j, Inc. All rights reserved.
26
NOT!
Treasure
Relationship
traversal NOT
optimal!
© 2022 Neo4j, Inc. All rights reserved.
Room
27
PATH_TO
_ROOM
PATH_TO
_SHOP
PATH_TO_
MONSTER
PATH_TO
_TREASURE
PATH_TO
_GROOSE
Ahh! I know
which way to go
This WAY!
© 2022 Neo4j, Inc. All rights reserved.
28
Other Optimizations and
Validation
© 2022 Neo4j, Inc. All rights reserved.
Tuning Optimizations
• Have specific Relationship Types that lead to distinct Node Types
◦ Avoid the issue of extra traversals + filtering on end Node Labels
• Relationship Locking on Writes
◦ Be cognizant of potential locking issues
◦ Better in 4.3, but could still be an issue
• Avoid traversals through high degree nodes
◦ Cardinality expansion will kill performance and increase memory consumption
• Smart Aggregation
◦ Build intermediate aggregate nodes or use GDS
29
© 2022 Neo4j, Inc. All rights reserved.
Model Validation
• Sanity Checks
◦ Does your model answer your business problem(s)?
◦ Does your model ingest data properly?
• Usability
◦ During testing, does your model introduce usability issues?
• Performance
◦ During testing, does your model perform fast enough?
30
© 2022 Neo4j, Inc. All rights reserved.
Summary
• Whiteboard to get started
• Use Instance modeling and Logical modeling to answer questions
• Use Physical modeling to load data
• Tune your model
• Iterate
31
© 2022 Neo4j, Inc. All rights reserved.
© 2022 Neo4j, Inc. All rights reserved.
32
Happy Modeling!
Contact us at
sales@neo4j.com

More Related Content

What's hot (20)

PDF
Modern Data architecture Design
Kujambu Murugesan
 
PDF
Neo4j: The path to success with Graph Database and Graph Data Science
Neo4j
 
PDF
A Connections-first Approach to Supply Chain Optimization
Neo4j
 
PDF
Introduction to Knowledge Graphs for Information Architects.pdf
Heather Hedden
 
PDF
Data Modeling & Metadata for Graph Databases
DATAVERSITY
 
PDF
Workshop - Build a Graph Solution
Neo4j
 
PPTX
The Business Glossary, Data Dictionary, Data Catalog Trifecta
georgefirican
 
PDF
The Knowledge Graph Explosion
Neo4j
 
PDF
How a Semantic Layer Makes Data Mesh Work at Scale
DATAVERSITY
 
PDF
You Need a Data Catalog. Do You Know Why?
Precisely
 
PPTX
Data Lakehouse Symposium | Day 4
Databricks
 
PDF
Making Data Timelier and More Reliable with Lakehouse Technology
Matei Zaharia
 
PDF
Neo4j GraphDay Seattle- Sept19- neo4j basic training
Neo4j
 
PDF
Building a Knowledge Graph using NLP and Ontologies
Neo4j
 
PDF
Querying the Wikidata Knowledge Graph
Ioan Toma
 
PDF
Introduction to Knowledge Graphs and Semantic AI
Semantic Web Company
 
PDF
The perfect couple: Uniting Large Language Models and Knowledge Graphs for En...
Neo4j
 
PPTX
Introduction to Data Engineering
Vivek Aanand Ganesan
 
PDF
The Importance of Metadata
DATAVERSITY
 
PDF
Lessons in Data Modeling: Data Modeling & MDM
DATAVERSITY
 
Modern Data architecture Design
Kujambu Murugesan
 
Neo4j: The path to success with Graph Database and Graph Data Science
Neo4j
 
A Connections-first Approach to Supply Chain Optimization
Neo4j
 
Introduction to Knowledge Graphs for Information Architects.pdf
Heather Hedden
 
Data Modeling & Metadata for Graph Databases
DATAVERSITY
 
Workshop - Build a Graph Solution
Neo4j
 
The Business Glossary, Data Dictionary, Data Catalog Trifecta
georgefirican
 
The Knowledge Graph Explosion
Neo4j
 
How a Semantic Layer Makes Data Mesh Work at Scale
DATAVERSITY
 
You Need a Data Catalog. Do You Know Why?
Precisely
 
Data Lakehouse Symposium | Day 4
Databricks
 
Making Data Timelier and More Reliable with Lakehouse Technology
Matei Zaharia
 
Neo4j GraphDay Seattle- Sept19- neo4j basic training
Neo4j
 
Building a Knowledge Graph using NLP and Ontologies
Neo4j
 
Querying the Wikidata Knowledge Graph
Ioan Toma
 
Introduction to Knowledge Graphs and Semantic AI
Semantic Web Company
 
The perfect couple: Uniting Large Language Models and Knowledge Graphs for En...
Neo4j
 
Introduction to Data Engineering
Vivek Aanand Ganesan
 
The Importance of Metadata
DATAVERSITY
 
Lessons in Data Modeling: Data Modeling & MDM
DATAVERSITY
 

Similar to Graph Data Modeling Best Practices(Eric_Monk).pptx (20)

PDF
Training Series - Intro to Neo4j
Neo4j
 
PDF
Road to NODES Workshop Series - Intro to Neo4j
Neo4j
 
PPTX
Neo4j Training Introduction
Max De Marzi
 
PDF
Neo4j Graph Summit 2024 Workshop - EMEA - Breda_and_Munchen.pdf
Neo4j
 
PDF
3. Relationships Matter: Using Connected Data for Better Machine Learning
Neo4j
 
PDF
Pazu Netflix Video Downloader Download
mohsinraza05mb
 
PDF
Atlantis Word Processor 4.4.5.1 Free Download
blouch120kp
 
PPTX
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j
 
PDF
Adobe Substance 3D Designer 14.1.2.8986
blouch133kp
 
PDF
Pazu Netflix Video Downloader 1.7.3 Crack Free
alihamzakpa071
 
PDF
Neo4j 4 Overview
Neo4j
 
PDF
Training Week: Introduction to Neo4j 2022
Neo4j
 
PDF
Graphs for Data Science and Machine Learning
Neo4j
 
PDF
GraphSummit Toronto: Keynote - Innovating with Graphs
Neo4j
 
PDF
Graph Data Science: The Secret to Accelerating Innovation with AI/ML
Neo4j
 
PDF
Training Week: Introduction to Neo4j
Neo4j
 
PDF
Intro to Neo4j and Graph Databases
Neo4j
 
PPTX
Introduction: Relational to Graphs
Neo4j
 
PDF
Data Modeling Tricks for Neo4j
Max De Marzi
 
PDF
GPT and Graph Data Science to power your Knowledge Graph
Neo4j
 
Training Series - Intro to Neo4j
Neo4j
 
Road to NODES Workshop Series - Intro to Neo4j
Neo4j
 
Neo4j Training Introduction
Max De Marzi
 
Neo4j Graph Summit 2024 Workshop - EMEA - Breda_and_Munchen.pdf
Neo4j
 
3. Relationships Matter: Using Connected Data for Better Machine Learning
Neo4j
 
Pazu Netflix Video Downloader Download
mohsinraza05mb
 
Atlantis Word Processor 4.4.5.1 Free Download
blouch120kp
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j
 
Adobe Substance 3D Designer 14.1.2.8986
blouch133kp
 
Pazu Netflix Video Downloader 1.7.3 Crack Free
alihamzakpa071
 
Neo4j 4 Overview
Neo4j
 
Training Week: Introduction to Neo4j 2022
Neo4j
 
Graphs for Data Science and Machine Learning
Neo4j
 
GraphSummit Toronto: Keynote - Innovating with Graphs
Neo4j
 
Graph Data Science: The Secret to Accelerating Innovation with AI/ML
Neo4j
 
Training Week: Introduction to Neo4j
Neo4j
 
Intro to Neo4j and Graph Databases
Neo4j
 
Introduction: Relational to Graphs
Neo4j
 
Data Modeling Tricks for Neo4j
Max De Marzi
 
GPT and Graph Data Science to power your Knowledge Graph
Neo4j
 
Ad

More from Neo4j (20)

PDF
GraphSummit Singapore Master Deck - May 20, 2025
Neo4j
 
PPTX
Graphs & GraphRAG - Essential Ingredients for GenAI
Neo4j
 
PPTX
Neo4j Knowledge for Customer Experience.pptx
Neo4j
 
PPTX
GraphTalk New Zealand - The Art of The Possible.pptx
Neo4j
 
PDF
Neo4j: The Art of the Possible with Graph
Neo4j
 
PDF
Smarter Knowledge Graphs For Public Sector
Neo4j
 
PDF
GraphRAG and Knowledge Graphs Exploring AI's Future
Neo4j
 
PDF
Matinée GenAI & GraphRAG Paris - Décembre 24
Neo4j
 
PDF
ANZ Presentation: GraphSummit Melbourne 2024
Neo4j
 
PDF
Google Cloud Presentation GraphSummit Melbourne 2024: Building Generative AI ...
Neo4j
 
PDF
Telstra Presentation GraphSummit Melbourne: Optimising Business Outcomes with...
Neo4j
 
PDF
Hands-On GraphRAG Workshop: GraphSummit Melbourne 2024
Neo4j
 
PDF
Démonstration Digital Twin Building Wire Management
Neo4j
 
PDF
Swiss Life - Les graphes au service de la détection de fraude dans le domaine...
Neo4j
 
PDF
Démonstration Supply Chain - GraphTalk Paris
Neo4j
 
PDF
The Art of Possible - GraphTalk Paris Opening Session
Neo4j
 
PPTX
How Siemens bolstered supply chain resilience with graph-powered AI insights ...
Neo4j
 
PDF
Knowledge Graphs for AI-Ready Data and Enterprise Deployment - Gartner IT Sym...
Neo4j
 
PDF
Neo4j Graph Data Modelling Session - GraphTalk
Neo4j
 
PDF
Neo4j: The Art of Possible with Graph Technology
Neo4j
 
GraphSummit Singapore Master Deck - May 20, 2025
Neo4j
 
Graphs & GraphRAG - Essential Ingredients for GenAI
Neo4j
 
Neo4j Knowledge for Customer Experience.pptx
Neo4j
 
GraphTalk New Zealand - The Art of The Possible.pptx
Neo4j
 
Neo4j: The Art of the Possible with Graph
Neo4j
 
Smarter Knowledge Graphs For Public Sector
Neo4j
 
GraphRAG and Knowledge Graphs Exploring AI's Future
Neo4j
 
Matinée GenAI & GraphRAG Paris - Décembre 24
Neo4j
 
ANZ Presentation: GraphSummit Melbourne 2024
Neo4j
 
Google Cloud Presentation GraphSummit Melbourne 2024: Building Generative AI ...
Neo4j
 
Telstra Presentation GraphSummit Melbourne: Optimising Business Outcomes with...
Neo4j
 
Hands-On GraphRAG Workshop: GraphSummit Melbourne 2024
Neo4j
 
Démonstration Digital Twin Building Wire Management
Neo4j
 
Swiss Life - Les graphes au service de la détection de fraude dans le domaine...
Neo4j
 
Démonstration Supply Chain - GraphTalk Paris
Neo4j
 
The Art of Possible - GraphTalk Paris Opening Session
Neo4j
 
How Siemens bolstered supply chain resilience with graph-powered AI insights ...
Neo4j
 
Knowledge Graphs for AI-Ready Data and Enterprise Deployment - Gartner IT Sym...
Neo4j
 
Neo4j Graph Data Modelling Session - GraphTalk
Neo4j
 
Neo4j: The Art of Possible with Graph Technology
Neo4j
 
Ad

Recently uploaded (20)

PDF
July Patch Tuesday
Ivanti
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PDF
NewMind AI Journal - Weekly Chronicles - July'25 Week II
NewMind AI
 
PDF
Windsurf Meetup Ottawa 2025-07-12 - Planning Mode at Reliza.pdf
Pavel Shukhman
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
PDF
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PDF
Wojciech Ciemski for Top Cyber News MAGAZINE. June 2025
Dr. Ludmila Morozova-Buss
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PDF
Complete Network Protection with Real-Time Security
L4RGINDIA
 
PDF
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
PPTX
Building a Production-Ready Barts Health Secure Data Environment Tooling, Acc...
Barts Health
 
PPTX
Top iOS App Development Company in the USA for Innovative Apps
SynapseIndia
 
PDF
Building Resilience with Digital Twins : Lessons from Korea
SANGHEE SHIN
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PDF
TrustArc Webinar - Data Privacy Trends 2025: Mid-Year Insights & Program Stra...
TrustArc
 
July Patch Tuesday
Ivanti
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
NewMind AI Journal - Weekly Chronicles - July'25 Week II
NewMind AI
 
Windsurf Meetup Ottawa 2025-07-12 - Planning Mode at Reliza.pdf
Pavel Shukhman
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
Wojciech Ciemski for Top Cyber News MAGAZINE. June 2025
Dr. Ludmila Morozova-Buss
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
Complete Network Protection with Real-Time Security
L4RGINDIA
 
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
Building a Production-Ready Barts Health Secure Data Environment Tooling, Acc...
Barts Health
 
Top iOS App Development Company in the USA for Innovative Apps
SynapseIndia
 
Building Resilience with Digital Twins : Lessons from Korea
SANGHEE SHIN
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
TrustArc Webinar - Data Privacy Trends 2025: Mid-Year Insights & Program Stra...
TrustArc
 

Graph Data Modeling Best Practices(Eric_Monk).pptx

  • 1. © 2022 Neo4j, Inc. All rights reserved. © 2022 Neo4j, Inc. All rights reserved. Graph Data Modeling Best Practices Eric Monk, Principal Solutions Engineer
  • 2. © 2022 Neo4j, Inc. All rights reserved. What is a Graph Data Model? The structure and definition of the Nodes, Relationships, and Properties. Structure = How Labeled Nodes are connected via Relationship Types. Definition = Labels and Relationship Types used. Assignment of Properties to Labeled Nodes and Relationship Types along with their data types. 2 Explicit Graph Data Modeling is OPTIONAL, but very useful.
  • 3. © 2022 Neo4j, Inc. All rights reserved. Instance vs Model 3 :Person :Person :KNOWS name: String age: Integer Person Node Label KNOWS Relationship Type alice :Person bob :Person :KNOWS name: Bob age: 42 alice Node with Person Node Label KNOWS Relationship name and age Property Definitions Model name and age Properties with values Instance
  • 4. © 2022 Neo4j, Inc. All rights reserved. 4
  • 5. © 2022 Neo4j, Inc. All rights reserved. 5 We are here: Data Modeling
  • 6. © 2022 Neo4j, Inc. All rights reserved. 6 + More Questions + More Queries + More Data Need to harmonize inputs from multiple sources We need to iterate + Domain Expertise + Performance Concerns
  • 7. © 2022 Neo4j, Inc. All rights reserved. Types of Modeling Whiteboard - graph domain information Instance Model - graph example data to solve questions Logical Model - use Node Labels and Relationship Types to define graph structure + some Property Definition Physical Model - augment Logical Model with Property Definitions to support data load + constraints Tuned Model - account for previous misconceptions and performance concerns 7
  • 8. © 2022 Neo4j, Inc. All rights reserved. 8 Types of Models Model Type Domain Expertise Questions Data Load Cypher Queries Performance Constraints / Indexes Whiteboard Y Y Instance Model Y Y * Logical Model Y Y * * Physical Model Y Y Y Y * Y Tuned Model Y Y Y Y Y Y * Partial support
  • 9. © 2022 Neo4j, Inc. All rights reserved. 9 Types of Models Model Type Domain Expertise Questions Data Load Cypher Queries Performance Constraints / Indexes Whiteboard Y Y Instance Model Y Y * Logical Model Y Y * * Physical Model Y Y Y Y * Y Tuned Model Y Y Y Y Y Y * Partial support Similar level of detail - slightly different approaches
  • 10. © 2022 Neo4j, Inc. All rights reserved. 10 See Draw your model visually. Use a tool such as Arrows to create and view your model. Whiteboard Tips Know Use domain relevant language. Collaborate with domain experts to understand the real world processes the data represents. Limit Initially limit the scope of your model. Only include concepts and relationships relevant to an initial set of questions. Focus on concepts and how they are related.
  • 11. © 2022 Neo4j, Inc. All rights reserved. 11 Whiteboard Example
  • 12. © 2022 Neo4j, Inc. All rights reserved. 12 Define Define properties relevant to the nodes and relationships. Instance Model Tips Fill Create example nodes and relationships with representative data. Answer Trace paths to ensure questions can be answered. Write Cypher if needed. Representative Data. Focus on answering a question.
  • 13. © 2022 Neo4j, Inc. All rights reserved. 13 Instance Model Example
  • 14. © 2022 Neo4j, Inc. All rights reserved. 14 Node, Relationship, or Property? Item/Action Definition Node Relationship Property Business noun - Y (1) Y (2) How things relate - Y Anchor Starting point Y (3) Y (3) Traverse Visit matching relationships and nodes Y Y Degree Count of relationships per node Y Y (4) Filter Remove paths by examining property values Y Decorator Return property value Y
  • 15. © 2022 Neo4j, Inc. All rights reserved. Node, Relationship, or Property? (Notes) 15 Business noun - Node Domain concept Unique identifier Avoid supernodes (very high degree nodes) Business noun - Property Attribute of a Domain concept Small set of possible values Names, quantities, timestamps Anchor Both Node Label and Property are used to Anchor Degree Used to access Neo4j count store
  • 16. © 2022 Neo4j, Inc. All rights reserved. 16 Define Define properties relevant to the nodes and relationships. Logical Model Tips Guided Use node, relationship, and property guidance to decide proper graph structure. Answer Trace paths to ensure questions can be answered. Write Cypher if needed. Informed Modeling. Focus on answering a question.
  • 17. © 2022 Neo4j, Inc. All rights reserved. 17 Logical Model Example
  • 18. © 2022 Neo4j, Inc. All rights reserved. Data Discovery • Identify data sources node and properties in the model • Getting sample data • Identify primary keys / node keys • Can correlate across data sources? • Does your model map to existing sources? Any gaps? 18
  • 19. © 2022 Neo4j, Inc. All rights reserved. 19 Source Use details from relevant data sources to inform your modeling. Physical Model Tips Keys Determine node keys, constraints, and indexes to prepare for data load. Load Load data. Confirm structures are loaded properly and data types are correct. Enable loading of data. Question(s) should still be answered.
  • 20. © 2022 Neo4j, Inc. All rights reserved. 20 Physical Model Example
  • 21. © 2022 Neo4j, Inc. All rights reserved. 21 Iterate Make adjustments as needed to tune model based on additional data added or new questions to be answered. Tuning Your Model Performance Use specific Relationship Types to assist traversals. Ensure constraints and indexes are used properly. Validate Validate the model to ensure data is loaded properly, questions are answered. Focus on optimizing the model.
  • 22. © 2022 Neo4j, Inc. All rights reserved. 22 Relationship Types Example
  • 23. © 2022 Neo4j, Inc. All rights reserved. 23 images by OokamiKasumi and TransparentJiggly64 https://www.deviantart.com/ookamikasumi/art/Many-Doors-to-Wonderland-166917185 https://www.deviantart.com/transparentjiggly64/art/Champion-Link-Facing-Away-803623424 Room Imagine a room with many doors. Room = node Door = relationship
  • 24. © 2022 Neo4j, Inc. All rights reserved. Room 24 Treasure Our adventurer wants treasure.
  • 25. © 2022 Neo4j, Inc. All rights reserved. Room 25 PATH_TO PATH_TO PATH_TO PATH_TO PATH_TO ??? Treasure Uhh…which way to go?
  • 26. © 2022 Neo4j, Inc. All rights reserved. 26 NOT! Treasure Relationship traversal NOT optimal!
  • 27. © 2022 Neo4j, Inc. All rights reserved. Room 27 PATH_TO _ROOM PATH_TO _SHOP PATH_TO_ MONSTER PATH_TO _TREASURE PATH_TO _GROOSE Ahh! I know which way to go This WAY!
  • 28. © 2022 Neo4j, Inc. All rights reserved. 28 Other Optimizations and Validation
  • 29. © 2022 Neo4j, Inc. All rights reserved. Tuning Optimizations • Have specific Relationship Types that lead to distinct Node Types ◦ Avoid the issue of extra traversals + filtering on end Node Labels • Relationship Locking on Writes ◦ Be cognizant of potential locking issues ◦ Better in 4.3, but could still be an issue • Avoid traversals through high degree nodes ◦ Cardinality expansion will kill performance and increase memory consumption • Smart Aggregation ◦ Build intermediate aggregate nodes or use GDS 29
  • 30. © 2022 Neo4j, Inc. All rights reserved. Model Validation • Sanity Checks ◦ Does your model answer your business problem(s)? ◦ Does your model ingest data properly? • Usability ◦ During testing, does your model introduce usability issues? • Performance ◦ During testing, does your model perform fast enough? 30
  • 31. © 2022 Neo4j, Inc. All rights reserved. Summary • Whiteboard to get started • Use Instance modeling and Logical modeling to answer questions • Use Physical modeling to load data • Tune your model • Iterate 31
  • 32. © 2022 Neo4j, Inc. All rights reserved. © 2022 Neo4j, Inc. All rights reserved. 32 Happy Modeling! Contact us at [email protected]