Query regarding base case

in this question the graph which we are given have all their vertices connected to each other but there can be a case in which when in base case our present node is not directly connected to our source node so in that case we can’t return value from the distance matrix.
so in such a case do we also need some shortest path algorithm , to return the shortest path between our base case vertex and the source.

hello @Parmeet-Kalsi-1631789033630118
are u talking about tsp ?

Yess…

In tsp cities will always be connected