DSAverse
Graph Algorithms
Loading Graph Algorithms...
BFS Traversal
visited: 0 / 7Initializing Sorting Algorithms...
Sorting
Trees
Graphs
Preparing interactive visualizations...
Graph Algorithms
Loading Graph Algorithms...
BFS Traversal
visited: 0 / 7Explore graphs through interactive visualizations. Watch how algorithms traverse nodes and edges to find paths, components, and optimal structures.
Explores a graph level by level, visiting all neighbors of a node before moving to the next level. Uses a queue and guarantees shortest paths in unweighted graphs.
O(V + E)O(V)Explores as far as possible along each branch before backtracking. Uses a stack (or recursion) and is the foundation for cycle detection, topological sort, and more.
O(V + E)O(V)Finds the shortest path from a source node to all other nodes in a weighted graph with non-negative edges. Uses a greedy approach with a priority queue.
O((V + E) log V)O(V)Identifies all groups of nodes that are connected to each other in an undirected graph. Can be found using BFS or DFS.
O(V + E)O(V)Finds the minimum spanning tree of a weighted undirected graph using a greedy algorithm. Starts from an arbitrary node and grows the tree by adding the cheapest edge.
O((V + E) log V)O(V)Orders nodes in a Directed Acyclic Graph such that every directed edge goes from earlier to later in the ordering. Essential for task scheduling and dependency resolution.
O(V + E)O(V)Finds shortest paths between all pairs of nodes in a weighted graph. Uses dynamic programming and works with negative weights (but not negative cycles).
O(V³)O(V²)Finds the minimum spanning tree by sorting all edges by weight and greedily adding edges that don't create a cycle. Uses Union-Find data structure.
O(E log E)O(V)DFS-based topological ordering: run DFS and push each node to a stack on completion. Reverse of the completion order gives a valid topological ordering.
O(V + E)O(V)Understanding these fundamentals will help you master graph algorithm visualizations.
A fundamental unit in a graph. Each node represents an entity — a city, a person, a state in computation.
A connection between two vertices. Can be directed (one-way) or undirected (two-way), and optionally weighted.
Two nodes are adjacent if there is a direct edge between them. The set of all neighbors defines a node's adjacency list.