Compass Interview Question

A fairly difficult graph traversal problem, not ideal for JS