Graph Visualizer
Graph Traversal
Trace BFS, DFS, and Dijkstra across a weighted directed graph with frontier, visited, settled, and distance state.
O((V + E) log V)
Step Note
Initialize distances from the start node.
function dijkstra(graph: Graph, start: Node) {
initializeDistances(start)
while (frontier.hasNodes()) {
const node = extractNearestNode()
settle(node)
for (const edge of graph.outgoing(node)) {
relax(edge)
}
}
return distances
}