Dynamic programming for the shortest route in the graph.

I'm trying to calculate the shortest route using dynamic programming in Python. I have all the data stored correctly as weighted segments (roads) and nodes (cities) of a graph, so it is not a problem, the fact is that I do not know how to apply dynamic programming to solve this. I only know that to go from A to B, I have to divide the problem into subproblems, but I do not know how to create an algorithm that works, I mean the steps that the algorithm should follow and how I should divide the problems into small problems.

Thanks for your help!