add mincost with dijkstra(partially tested)