Loading Thita. Almost there...

    Learning PathDSAGraph Traversal Patterns - DFS and BFS
    Back to DSA

    Pattern 10 of 15

    Graph Traversal Patterns - DFS and BFS

    Master graph algorithms including DFS/BFS traversal, topological sort, shortest paths (Dijkstra, Bellman-Ford), Union-Find, and advanced graph concepts.

    Subpatterns

    12

    Est. Time

    180 min

    Subpatterns

    1.

    DFS Connected Components - Island Counting

    Use DFS to find connected components and count islands in grids. Flood fill and province counting problems.

    2.

    BFS Connected Components - Shortest Path in Grid

    Use BFS for shortest path in unweighted graphs. Solve word ladder, rotting oranges, and matrix problems.

    3.

    Topological Sort - Kahn's Algorithm

    Master topological sorting using Kahn's BFS algorithm. Solve course schedule and build order problems.

    4.

    Cycle Detection in Directed Graph

    Detect cycles in directed graphs using DFS with coloring (white, gray, black) approach.

    5.

    Bellman-Ford and BFS with K Stops

    Find shortest paths with constraints using Bellman-Ford algorithm and BFS with limited stops.

    6.

    Dijkstra's Algorithm for Shortest Path

    Master Dijkstra's algorithm for finding shortest paths in weighted graphs with non-negative edges.

    7.

    Graph Deep Copy and Cloning

    Learn to deep copy and clone graph structures using DFS/BFS with visited mapping.

    8.

    Bidirectional BFS Optimization

    Optimize BFS by searching from both source and target simultaneously. Reduce time complexity significantly.

    9.

    Bridges and Articulation Points - Tarjan

    Find bridges and articulation points in graphs using Tarjan's low-link algorithm.

    10.

    Union-Find - Disjoint Set Union

    Master Union-Find data structure with path compression and union by rank for connectivity problems.

    11.

    Minimum Spanning Tree - Kruskal and Prim

    Find minimum spanning tree using Kruskal's or Prim's algorithm with Union-Find or heap.

    12.

    Strongly Connected Components

    Find strongly connected components in directed graphs using Kosaraju's or Tarjan's algorithm.

    Start Learning Graph Traversal Patterns - DFS and BFS

    Access theory, code examples, and practice problems.

    Open DSA Learning Path
    PreviousTree Traversal Patterns - DFS and BFSNextGreedy Algorithm Patterns