changes to connected components, dijkstra (significant speed up)