Graphs and Social Network Applications

Introduction

Social networks are, at their core, graphs: people (or accounts, pages, wallets) are vertices, and relationships (friendship, following, messaging, transactions) are edges. Once you model a platform this way, questions that sound social become questions about graph structure — How many hops separate two users? Which accounts sit at the center of a cluster? Which groups of users are densely connected to each other but sparsely connected to everyone else? How fast would a post spread if it started here?

In this module you have been looking at how real systems compose data structures to meet concrete requirements, and graphs are the structure that carries relationship and influence. Two representation choices dominate practice: the adjacency matrix, which gives constant-time edge lookup at the cost of space proportional to the square of the vertex count, and the adjacency list, which is far more compact for the sparse graphs that real social networks actually are. On top of whichever representation you choose, the two workhorse traversals — breadth-first search and depth-first search — power features such as degrees-of-separation and "people you may know" (BFS, which explores level by level) and connected-component or community discovery (DFS, which dives deep along a path before backtracking).

The videos below focus on those traversals, since mastering BFS and DFS mechanics is what makes the application-level topics (centrality, information flow, platform design) tractable. While you watch, pay attention to three things: the auxiliary structure each algorithm uses (queue for BFS, stack or recursion for DFS), how the visited set prevents infinite looping in cyclic graphs, and the order in which vertices are discovered. Then mentally re-map each example graph onto a friend network and ask what the traversal output would mean in that setting.

Video 1: L-4.15: BFS & DFS | Breadth First Search | Depth First Search | Graph Traversing | DAA

Gate Smashers · 11:16 · 2,509,205 views · 4y ago · captions — Watch on YouTube

About this video

A side-by-side introduction to breadth-first search and depth-first search as graph traversal strategies, covering how each algorithm visits vertices and the supporting structures (queue for BFS, stack/recursion for DFS) that produce those orders. Based on its title and course framing (DAA), it is likely to work through traversal examples on sample graphs and discuss the algorithms' behavior and complexity.

Why this video

Because it presents both traversals in one lecture, it is the best starting point for seeing how BFS and DFS differ in exploration order — the distinction that explains why one suits connection discovery and the other suits component and community exploration. Gate Smashers is a widely used exam-prep channel with a step-by-step lecture style, and the view count reflects its popularity with CS students.

Video 2: Breadth-first search in 4 minutes

Michael Sambol · 3:59 · 603,429 views · 4y ago · captions — Watch on YouTube

About this video

A compact four-minute treatment of breadth-first search: the level-by-level exploration pattern, the queue that drives it, and the visited marking that keeps traversal finite. The description links to a Python implementation, so you can read the code alongside the explanation.

Why this video

Short, precise videos like this are ideal for review before tracing BFS by hand on a social graph, which is exactly what connection discovery and shortest-hop (degrees-of-separation) features require. Michael Sambol's algorithm series is well known for accurate, no-filler visual walkthroughs paired with published code.

Video 3: Depth-first search in 4 minutes

Michael Sambol · 4:01 · 550,064 views · 4y ago · captions — Watch on YouTube

About this video

The companion video on depth-first search, explaining how the algorithm follows one path as far as possible before backtracking, and how recursion or an explicit stack implements that behavior. A linked Python implementation is provided for readers who want to connect the trace to working code.

Why this video

DFS is the traversal behind connected-component identification and the clustering intuitions underlying community detection, so a clean, correct explanation of its backtracking behavior directly supports that subtopic. Watching it immediately after the BFS video makes the structural contrast between the two algorithms easy to internalize.

How These Videos Support the Learning Outcomes

These three videos concentrate on MO3: by the end of them you should be able to trace BFS and DFS step by step on a graph, name the auxiliary structure each uses, and explain why BFS produces shortest-hop distances while DFS reaches entire connected regions — the mechanics behind connection discovery and community detection features. They also provide the operational grounding for MO2, since the per-vertex neighbor iteration shown in every traversal trace is precisely the operation that adjacency lists make cheap and adjacency matrices make expensive on sparse social graphs; keep that cost comparison in mind as you watch. Finally, because MO4 and MO5 ask you to evaluate and design multi-structure systems, treat these traversals as components you can now justify choosing: the videos supply the algorithmic behavior, and your course readings on representations, centrality, and platform case studies supply the design context in which that behavior pays off.

About These Videos

These videos were chosen from YouTube on October 2, 2026. Each has captions; the player turns them on. Videos on YouTube can be changed or removed — if one no longer plays, tell your instructor. If a player does not appear, use its Watch on YouTube link.