my old implementation of the bellman ford algorithm using python trying to be modular