CS314 A*/Prim/Dijkstra implementation with Cons data structure