make dv algorithm right

rewrite routing function now the dv algorithm is right and well