Dijkstra tracks the best cost to reach each position. In a normal graph, position is the entire state. Here, position alone is not enough. Why?
Because arriving at city with stops left is different from arriving at city with stops left. The first state is a dead end. The second can still explore neighbors. Your state is a pair: (city, stops_remaining). You track the best cost to reach each (city, k) pair. That's how you handle the constraint.