Dijklstra works with directed and undirected edges