diff --git a/pytools/graph.py b/pytools/graph.py
index 1a02484151b2d40abfb22037edb339d24777096d..9fd6f2603f6e52162db813432dfff13a34876b03 100644
--- a/pytools/graph.py
+++ b/pytools/graph.py
@@ -287,7 +287,7 @@ def compute_topological_order(graph: GraphT[NodeT],
 
     # {{{ compute nodes_to_num_predecessors
 
-    nodes_to_num_predecessors = {node: 0 for node in graph}
+    nodes_to_num_predecessors = dict.fromkeys(graph, 0)
 
     for node in graph:
         for child in graph[node]: