🧮Graph (Data Structure)
Also known as Graph, Network Graph, Nodes and Edges
Nodes joined by edges, where any node can link to any other.
Think of it like
Think of it like a map of towns joined by roads. Any town can link to any other.
Example
Emma's social app stores who follows whom as a graph. Finding friends of friends means walking two edges out from her.
Why it matters
Road trips, friend lists and web links are all graph problems underneath.
Definition
Common mistake
Key takeaways
- 1Nodes and edges. Things and links.
- 2Loops allowed. Unlike a tree.
- 3Direction and weight. One-way, distance, cost.