Difference equations on weighted graphs