© 2026 Hashnode
While working on a recent graph traversal problem, I made an assumption that would prove costly: that Depth-First Search (DFS) and Breadth-First Search (BFS) are interchangeable algorithms. This misconception led me down a rabbit hole of debugging be...

When to Use BFS vs DFS Use BFS when: Shortest Path in Unweighted Graphs - BFS guarantees the shortest path because it explores nodes level by level Level-order Traversal - When you need to process nodes level by level Finding Minimum Steps - Any pro...

Introduction Dijkstra's Algorithm is one of the most widely used algorithms in graph theory. It efficiently finds the shortest path from a source vertex to all other vertices in a weighted graph. Named after Edsger W. Dijkstra, who introduced it in 1...

Introduction When solving shortest path problems in graph theory, Bellman-Ford Algorithm and Dijkstra’s Algorithm are two of the most prominent approaches. While both aim to find the shortest path from a source node to other nodes in a graph, their m...

What is Dijkstra's Algorithm? Dijkstra's Algorithm is a renowned algorithm used to find the shortest paths between nodes in a graph. It is widely used in routing and as a foundation for various network-related applications. Whether you're navigating ...

Three commonly used methods for determining the shortest path from a single starting node require a fundamental understanding of graphs. These algorithms are as follows: Shortest path in a Directed Acyclic Graph (DAG) using topological sorting The ...

Introduction In a directed acyclic graph (DAG), a topological sort is a linear ordering of the vertices such that for every directed edge, the vertex u comes before v in the ordering. This ordering can be used to find the shortest path between two ve...
