Freenome interview question

Graph traversal problem (implementing the data structures as well)