Thinking in Graphs
A Tech Talk, 3/3/23
![](https://s3.amazonaws.com/media-p.slid.es/uploads/335775/images/7099492/white.png)
©2021 Copyright - Confidential and Proprietary
![](https://s3.amazonaws.com/media-p.slid.es/uploads/335775/images/7099506/color.png)
©2021 Copyright - Confidential and Proprietary
What We'll Cover
- What data graphs are / can be
- How to think about your data in a graph
- How data graphs differ from other data modeling approaches
- The value of data graphs
- When to use a data graph
![](https://s3.amazonaws.com/media-p.slid.es/uploads/335775/images/7099506/color.png)
©2021 Copyright - Confidential and Proprietary
What is a data graph?
![](https://media.tenor.com/F-LgB1xTebEAAAAC/look-at-this-graph-nickelback.gif)
What is a data graph?
- A data graph is an approach to structuring data that is focused on relationships between entities.
- It's non-linear architecture allows for more flexibility and enables you to create connections between disparate pieces of data to provide new and powerful insights.
- When we talk about data within a data graph we generally refer to entities as "nodes", and connections between entities as "edges".
![](https://s3.amazonaws.com/media-p.slid.es/uploads/335775/images/10271808/based-on-graph.gif)
How do they work?
- Based on graph theory, a mathematical approach to model pairwise relations between objects.
- It connects vertices in a network through edges.
![](https://s3.amazonaws.com/media-p.slid.es/uploads/335775/images/10272079/maths.webp)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/335775/images/7099506/color.png)
©2021 Copyright - Confidential and Proprietary
How we got here
![](https://media4.giphy.com/media/SsYvscP7pgHTMldeAY/giphy.gif)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/335775/images/7099506/color.png)
©2021 Copyright - Confidential and Proprietary
How we got here
- Driven by a more recent change in how we think about data, which impacted how we structure it.
- Thinking shifted from how to most efficiently store data to how to get the most value out of it.
- Realization that data is inherently more valuable when it is connected.
![](https://s3.amazonaws.com/media-p.slid.es/uploads/335775/images/10271424/graph-timeline.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/335775/images/7099506/color.png)
©2021 Copyright - Confidential and Proprietary
The gold rush
![](https://s3.amazonaws.com/media-p.slid.es/uploads/335775/images/10271479/MicrosoftTeams-image-7-.webp)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/335775/images/10271486/neo4j-graph-database.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/335775/images/10271489/graphdb.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/335775/images/10271490/cayley.webp)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/335775/images/10271498/datastax.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/335775/images/10271491/graphql.webp)
GraphQL
![](https://s3.amazonaws.com/media-p.slid.es/uploads/335775/images/10271509/stardog.png)
Stardog
![](https://s3.amazonaws.com/media-p.slid.es/uploads/335775/images/10271483/dgraph.png)
DGraph
Notable implementations
![](https://s3.amazonaws.com/media-p.slid.es/uploads/335775/images/10271743/netflix.webp)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/335775/images/10271745/linkedin-graph.jpeg)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/335775/images/7099506/color.png)
©2021 Copyright - Confidential and Proprietary
A shift in mindset needs to occur in order to see the value [in data graphs]. This mindset is a shift from thinking about your data in a table to prioritizing the relationships across it.
- Matthias Broecheler
![](https://s3.amazonaws.com/media-p.slid.es/uploads/335775/images/7099506/color.png)
©2021 Copyright - Confidential and Proprietary
Shifting our mindset
![](https://media3.giphy.com/media/lKXEBR8m1jWso/giphy.gif)
Trees vs. Graphs
![](https://s3.amazonaws.com/media-p.slid.es/uploads/335775/images/10270743/Data_Tree__1_.png)
- All trees are Graphs, but not all graphs are trees...
- Trees are linear, they have a single root node and flow in a single direction.
- Can connect to other leaf nodes or more subtrees, but connections happen in a specific order.
Trees vs. Graphs
![](https://s3.amazonaws.com/media-p.slid.es/uploads/335775/images/10270770/Data_Graph__1_.png)
- Graphs are omnidirectional
- They have no defined end or beginning, they have multiple "entrypoints"
- Connections to nodes within a graph can be
Multiple Entrypoints
![](https://s3.amazonaws.com/media-p.slid.es/uploads/335775/images/10271851/entrypoint-2.webp)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/335775/images/10271852/entrypoint-1.webp)
Relational vs. Graph
![](https://s3.amazonaws.com/media-p.slid.es/uploads/335775/images/10272225/relational-db-update.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/335775/images/10272230/Book_in_graph.png)
- Relational model uses foreign keys to relate data together.
- Relational focuses on storing tabular data for people, places, and things.
- Graphs make it easier to create richer data connections with edges.
What does a healthy data graph look like?
- Many connections on each node, and many paths to each node through various entrypoints.
- Common entities referenced throughout the graph, enriched with relationship-specific data via edges.
- Few if-any "dead ends" within the graph where nodes are only accessible via a single entrypoint.
![](https://s3.amazonaws.com/media-p.slid.es/uploads/335775/images/10270743/Data_Tree__1_.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/335775/images/10270770/Data_Graph__1_.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/335775/images/7099506/color.png)
©2021 Copyright - Confidential and Proprietary
Edges
![](https://media.giphy.com/media/jbKbdoKJOFusHTjl80/giphy-downsized-large.gif)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/335775/images/7099506/color.png)
©2021 Copyright - Confidential and Proprietary
Edges
- Edges are the connections between nodes within a graph
- They often contain data that can be attributed to the relationship of the nodes
- You can have directed or bidirectional edges within a graph
![](https://s3.amazonaws.com/media-p.slid.es/uploads/335775/images/10270944/Bidirectional_Edge.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/335775/images/10270949/Directional_Edge.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/335775/images/7099506/color.png)
©2021 Copyright - Confidential and Proprietary
Bidirectional Edges
- Bidirectional edges represent connections to nodes within a graph regardless of direction.
- In this example, the relationship between me and my dad can always be considered "family".
![](https://s3.amazonaws.com/media-p.slid.es/uploads/335775/images/10270990/BiDirectional_Edge_Example.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/335775/images/7099506/color.png)
©2021 Copyright - Confidential and Proprietary
Directional Edges
- Directional edges represent connections to nodes where directionality does matter.
- In this example we are looking at a graph of twitter followers. Me and Elon Musk are followed by Russian bots, and I follow Elon musk, but Elon doesn't follow me and neither of us follow the Russian bots.
![](https://s3.amazonaws.com/media-p.slid.es/uploads/335775/images/10271033/Directional_Edge_Example.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/335775/images/7099506/color.png)
©2021 Copyright - Confidential and Proprietary
The value of a data graph
![](https://s3.amazonaws.com/media-p.slid.es/uploads/335775/images/10271978/Graph_Example_Value.png)
- Allows us to enrich connections from disparate data sources with highly valuable information.
- We can use edge data to personalize experiences for the user.
- Personalized experiences can lead to better customer engagement & ultimately revenue.
![](https://s3.amazonaws.com/media-p.slid.es/uploads/335775/images/7099506/color.png)
©2021 Copyright - Confidential and Proprietary
How we leverage data graphs at NerdWallet
{
review {
title
authors {
name
}
categories {
id
articles {
title
authors {
name
}
}
}
marketplaceEntity {
id
name
review {
id
title
}
}
}
}
![](https://s3.amazonaws.com/media-p.slid.es/uploads/335775/images/10272036/Review_Graph.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/335775/images/7099506/color.png)
©2021 Copyright - Confidential and Proprietary
When to leverage a data graph
- Relationships within your data help you understand your problem better.
- A lot of the data you need is derived from the relationship between entities.
- Most of the complexity within your implementation will be around creating relationships between entities.
- Your entity models change often, and are highly connected to other models.
![](https://s3.amazonaws.com/media-p.slid.es/uploads/335775/images/7099506/color.png)
©2021 Copyright - Confidential and Proprietary
Takeaways
- Data graphs can be an effective tool for extracting more value from your data.
- Data graphs can help create more meaningful connections by enriching them with edge data.
- When working with data graphs we need to stop thinking about data linearly, and embrace graph thinking when modeling nodes and edges for a data graph.
![](https://s3.amazonaws.com/media-p.slid.es/uploads/335775/images/7099506/color.png)
©2021 Copyright - Confidential and Proprietary
![](https://s3.amazonaws.com/media-p.slid.es/uploads/335775/images/7103637/nw-logo.png)
Thanks for coming! Questions?
Thinking in Graphs
By Ryan Kanner
Thinking in Graphs
- 275