Question DSA-GRAPH-0040
EasyWhat is the output of this code?
edges = [(1, 2), (1, 3), (2, 3), (3, 4)]
deg = {}
for u, v in edges:
deg[u] = deg.get(u, 0) + 1
deg[v] = deg.get(v, 0) + 1
print(deg[3])
- A.
1
- B.
2
- C.
Sign up free to see the answer and a step-by-step explanation.