A* Search Algorithm
A complete guide to the A* Search Algorithm with interactive grid visualization, explanations, heuristic functions, implementations in Python, Java, C++, and JavaScript, and related LeetCode problems.
A complete guide to the A* Search Algorithm with interactive grid visualization, explanations, heuristic functions, implementations in Python, Java, C++, and JavaScript, and related LeetCode problems.
Adjacency list is used to represent a graph using array and linked list
An adjacency matrix is a 2D array used to represent a graph, where each cell (i, j) is set to 1 if there's an edge from node i to node j, and 0 otherwise.
A complete guide to the Bellman-Ford Algorithm — find shortest paths in graphs with negative edge weights and detect negative weight cycles. Includes pseudocode, step-by-step trace, and implementations in C, C++, Java, and Python.
A complete guide to the Bellman-Ford Algorithm with explanations, dry run, negative cycle detection, implementations in Python, Java, C++, and JavaScript, and related LeetCode problems.
A side-by-side comparison of Breadth-First Search (BFS) and Depth-First Search (DFS) graph traversal algorithms.
A complete guide to Bidirectional Search algorithm for finding shortest paths in unweighted graphs with explanations and implementations.
A bipartite graph is a graph whose vertices can be divided into two disjoint sets such that no two vertices within the same set are adjacent.
In this blog post, we'll explore Breadth-First Search (BFS), a graph traversal algorithm used to explore vertices and edges level by level in a graph.
A complete guide to Breadth-First Search (BFS) algorithm with explanations, use cases, and implementations in Python, Java, C++, and JavaScript.
Solution for LeetCode 787: Cheapest Flights Within K Stops, utilizing BFS (Modified Dijkstra) to find the cheapest flight path within K stops.
In this blog post, we'll explore Depth-First Search (DFS), a graph traversal algorithm used to explore vertices and edges by going as deep as possible before backtracking.
A complete guide to Depth-First Search (DFS) algorithm with explanations, use cases, and implementations in Python, Java, C++, and JavaScript.
In this blog post, we'll explore Depth-First Search (DFS) using Java, a graph traversal algorithm used to explore vertices and edges by going as deep as possible before backtracking.
Comparison of Dijkstra's and Bellman-Ford algorithms for finding single-source shortest paths in graphs.
This post covers Dijkstra's Algorithm for finding the shortest paths in a graph, with code examples and explanations.
A complete guide to Dijkstra's Algorithm with explanations, use cases, and implementations in Python, Java, C++, and JavaScript.
Solution for LeetCode 802: Find Eventual Safe States, utilizing Graph Traversal (DFS Cycle Detection) and BFS (Kahn's Algorithm).
Solution for LeetCode 733: Flood Fill, utilizing Graph Traversal (DFS).
Learn the Floyd-Warshall Algorithm for solving the All-Pairs Shortest Path problem using Dynamic Programming.
A complete guide to Floyd-Warshall Algorithm with explanations, use cases, and implementations in Python, Java, C++, and JavaScript.
The program is to return a deep copy of the graph, preserving the structure and values of its nodes.
Reverse a directed graph so that the incoming edges will be converted to outgoing edges betwwen the same nodes.
A complete guide to Kosaraju's Algorithm for finding Strongly Connected Components (SCCs) in a directed graph with explanations and implementations.
Calculating the longest path from a given source in a Directed Acyclic Graph (DAG) with weighted edges.
The multistage graph problem is finding the path with minimum cost from source to sink.
Solution for LeetCode 200: Number of Islands, utilizing Graph Traversal (DFS) to count connected components in a matrix.
Solution for LeetCode 1319: Number of Operations to Make Network Connected, utilizing Graph Traversal (DFS) to count connected components.
Solution for LeetCode 547: Number of Provinces, utilizing Graph Traversal (DFS) to find connected components.
Solution for LeetCode 1631: Path With Minimum Effort, utilizing Dijkstra's Algorithm with a Min-Priority Queue on a 2D grid.
1. Easy Level
Practice problems for Graphs to help you understand the concepts better.
Solve the Rotten Oranges problem using Breadth-First Search (BFS) to determine the minimum time required for all fresh oranges to rot.
Solution for LeetCode 130: Surrounded Regions, utilizing Graph Traversal (DFS) on the boundaries to capture enclosed components.
A complete guide to Tarjan's Algorithm for Strongly Connected Components (SCCs) with explanations, use cases, and implementations in Python, Java, C++, and JavaScript.
A complete guide to Topological Sort with explanations, use cases, and implementations in Python, Java, C++, and JavaScript.
Solution for LeetCode 127: Word Ladder, utilizing Breadth-First Search (BFS) to find the shortest transformation sequence.