Edges: In directed graphs, edges have a direction. They are represented as ordered pairs (u, v), where the edge goes from vertex u to vertex v. The direction is crucial and can’t be reversed.
Representation: They can be represented using an adjacency matrix where the entry at position (i, j) is non-zero if there is a directed edge from vertex i to vertex j.
Example: A social media network where user A follows user B, but not necessarily vice versa.
Undirected Graphs:
Edges: In undirected graphs, edges have no direction. They are represented as unordered pairs {u, v}. The edge between u and v is the same as the edge between v and u.
Representation: They can be represented using an adjacency matrix where the matrix is symmetric (i.e., the entry at (i, j) is the same as the entry at (j, i)).
Example: A network of friends where if user A is friends with user B, then user B is also friends with user A.