Graph
Things and the connections between them — representations, BFS, DFS, components, cycles, and grids.
This topic is part of Pro.
Free covers the C and Python courses, the first three DSA topics, the opening system design lessons and the beginner AI lessons, all with the full coach. Pro opens the rest of the library in the FollowtheDamnCode app.
What is in it
- 1Graphs and how to store themVertices, edges, direction and weight — and choosing between an adjacency list, a matrix, or an edge list. Pro
- 2Breadth-first search on graphsExplore level by level with a queue and a visited set — shortest paths when every edge costs the same. Pro
- 3Depth-first search on graphsGo as deep as possible before backing up — recursively or with a stack — to explore, copy, and find paths. Pro
- 4Connected components, cycles, and bipartite graphsCount separate pieces, detect cycles (with parents or with three colours), and two-colour a graph. Pro
- 5Grids as graphsCells are vertices, the four neighbours are edges — flood fill islands, border searches, and reverse thinking. Pro