updates some functions to allow for weighted graphs