Graph Theory Basics
Vertices and edges — the abstract structure behind networks, maps, and relationships, with degree, paths, trees, and the basic search algorithms (BFS/DFS) that traverse them.
A graph is a collection of vertices (or nodes) connected by edges. Graphs model anything that's really a network of relationships: people and friendships, cities and roads, web pages and hyperlinks, computers and network connections.
A graph is directed if edges have a direction (A → B, but not necessarily B → A — like a one-way street or a "follows" relationship), and undirected if edges go both ways equally (like a mutual friendship or a two-way road).
Each person is a vertex; an undirected edge connects two people who are friends. The number of edges touching a vertex is its degree — the number of friends that person has in the network.
Is a "follows" relationship on social media better modeled as a directed or undirected graph?
Solution
Directed — following someone doesn't mean they follow you back. An edge from A to B (A follows B) doesn't imply an edge from B to A.