api: YAML JSON TOON Database version: 1.0.0 format: json dataset: slug: graph-traversal-algorithms title: Graph Traversal Algorithms description: Fundamental algorithms for navigating graphs. summary: "Algorithms for exploring and searching graphs: breadth-first and depth-first search, Dijkstra, Bellman-Ford, A* and Floyd-Warshall, with bidirectional search, iterative deepening, uniform-cost and greedy best-first search, topological sorting and Johnson's all-pairs algorithm." use_when[2]: You need the right traversal or shortest-path algorithm for a graph.,You are comparing informed and uninformed search. caveats[2]: "Choice depends on edge weights, graph size and whether you need one path or all pairs.",A* is only optimal when its heuristic is admissible (never overestimates). related[4]: graph-algorithms,advanced-graph-algorithms,backtracking-algorithms,search-algorithms category: Algorithms category_slug: algorithms tags: "algorithms,graphs,traversal" view_count: 0 entry_count: 12 fields[3]{section,field,type,example}: data,name,string,Breadth-First Search data,type,string,Traversal data,description,string,Explore all neighbors at current depth before d… data[12]{name,type,description}: Breadth-First Search,Traversal,Explore all neighbors at current depth before deeper vertices. Depth-First Search,Traversal,Explore as far as possible along each branch before backtracking. Dijkstra,Shortest Path,Greedy shortest path from a source with non-negative edges. Bellman-Ford,Shortest Path,Handles negative edge weights and detects negative cycles. A* Search,Heuristic Search,Uses a heuristic to guide pathfinding efficiently. Floyd-Warshall,All-Pairs Shortest Path,Dynamic programming shortest paths between every pair of vertices. Uniform-Cost Search,Shortest path,Expands the lowest-cost path first; equivalent to Dijkstra's algorithm on a graph. Iterative Deepening DFS,Traversal,"Repeats depth-limited DFS with increasing limits, combining DFS memory use with BFS completeness." Bidirectional Search,Shortest path,"Searches forward from the start and backward from the goal, meeting in the middle." Greedy Best-First Search,Informed search,Expands the node that looks closest to the goal by a heuristic; fast but not guaranteed optimal. Topological Sort,Ordering,Orders the nodes of a directed acyclic graph so every edge points forward. Johnson's Algorithm,All-pairs shortest path,"Reweights edges with Bellman-Ford, then runs Dijkstra from every node; efficient for sparse graphs."