TOPIC
Nodes and edges: representation, traversal, shortest paths, MSTs.
WHY DID WE NEED GRAPHS?
THE WALLTrees forbid cycles and multiple routes — but roads loop, friends form circles, the web links everywhere. Real networks are not hierarchies.
THE IDEADrop every restriction: nodes plus ANY edges — directed or not, weighted or not, cycles welcome. Everything before this is just a special-case graph.
Google Maps, social networks, the internet itself: nodes and edges, with cycles and many routes between two points.
How a graph lives in memory: matrix vs list.
Visit every reachable node — in rings (BFS) or by diving deep (DFS).
Cheapest routes: greedy, brute-force, and all-pairs.
Connect everything at minimum total cost.
Weak points and strong groups: bridges, cut vertices, SCCs.