Code Room
Code reviewHard
Question
Review this Python graph engine. Each node has its own lock; an edge update locks both endpoints.
What a strong answer looks like
Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.
Learn the concepts
class Node: def __init__(self, name): self.name = name self.lock = threading.Lock() self.edges = {} def add_edge(a: Node, b: Node, weight): with a.lock: with b.lock: a.edges[b.name] = weight b.edges[a.name] = weightRun or narrate your approach, then ask the coach.