Graph Visualizer
Graph Traversal
Trace BFS, DFS, and Dijkstra across a weighted directed graph with frontier, visited, settled, and distance state.
Almost O(1) per operation
Step Note
Start with each node in its own disjoint set.
function unionFind(edges: Edge[]) {
const parent = makeSet()
for (const edge of edges) {
if (find(edge.u) !== find(edge.v)) {
union(edge.u, edge.v)
}
}
}