From 4b0cc4392f0e9da5c6c7d047df687c4475f5d196 Mon Sep 17 00:00:00 2001 From: Shreyash <62343225+SniperBuddy101@users.noreply.github.com> Date: Fri, 20 Mar 2026 10:58:47 +0530 Subject: [PATCH] contents/graph: use popleft() instead of pop() in Topological sort queue (#685) --- apps/website/contents/algorithms/graph.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/website/contents/algorithms/graph.md b/apps/website/contents/algorithms/graph.md index 2e9f0dfe..77fab1b3 100644 --- a/apps/website/contents/algorithms/graph.md +++ b/apps/website/contents/algorithms/graph.md @@ -180,7 +180,7 @@ def graph_topo_sort(num_nodes, edges): if nodes[node_id]['in'] == 0: queue.append(node_id) while len(queue): - node_id = queue.pop() + node_id = queue.popleft() for outgoing_id in nodes[node_id]['out']: nodes[outgoing_id]['in'] -= 1 if nodes[outgoing_id]['in'] == 0: