Amazon Interview Question

Coding problem on graph data structure.