// TOPIC

#graphs

7 articles

Beginner
01

Graphs: Everything Is Connected

The graph data structure models the real world — maps, social networks, dependencies — better than any other. Learn how nodes and edges work, how to represent them, and how BFS and DFS let you actually do something useful with them.

#graphs#data-structures#bfs
10 min
◆◆IntermediateGoogleAmazon
02

Union-Find (Disjoint Set Union)

The near-magic data structure for connectivity queries — are these two nodes in the same component? Nearly O(1) per operation with union by rank and path compression. Kruskal's MST, redundant connections, account merging, and more.

#union-find#disjoint-set-union#graphs
11 min
◆◆IntermediateGoogleMeta
03

Graphs

The data structure that models everything connected — social networks, road maps, dependency chains, and more. Master representations, traversals, and the "model it as a graph" reframe that unlocks whole categories of problems.

#graphs#data-structures#bfs
11 min
◆◆IntermediateGoogleAmazon
04

Topological Sort

Order the nodes of a DAG so every edge points forward — the algorithm that drives build systems, package managers, course schedulers, and anything else that lives and dies by dependency ordering.

#graphs#dag#topological-sort
13 min
◆◆◆AdvancedGoogleAmazon
05

Shortest Paths (Dijkstra, Bellman-Ford, BFS)

Pick the right shortest-path algorithm the first time: BFS for unweighted graphs, Dijkstra with a heap for non-negative weights, Bellman-Ford when negative edges appear. Concrete worked examples, a decision table, and every gotcha that costs people the interview.

#graphs#shortest-path#dijkstra
13 min
◆◆IntermediateAmazonGoogle
06

DFS Patterns

Depth-first search is the backbone of cycle detection, flood fill, path enumeration, and clone graph — master the visited-set template, the 3-color trick, and when to reach for DFS over BFS.

#graphs#dfs#traversal
13 min
◆◆IntermediateAmazonGoogle
07

BFS Patterns

Queue-driven level-by-level traversal and why breadth-first search is the only guaranteed way to find shortest paths in unweighted graphs. Templates, traps, and four worked problems.

#graphs#bfs#traversal
11 min