Guided Notes
Graphs & Graph Traversal
Vertices and edges, directed and weighted graphs, adjacency lists and matrices, DFS, BFS, and cycle detection.
Graphs
Slide 1 / 5A graph is a set of vertices (nodes) connected by edges. Unlike trees, graphs can have cycles and any vertex can connect to any other.
• Undirected — edges go both ways (friendships). • Directed — edges have a direction (one-way streets, Twitter follows). • Weighted — edges carry a value like distance or cost (road maps). • Connected — every vertex can reach every other.
Social networks, the web, maps, and dependency trees are all graphs.
