At the command line, type this:
In my version of MATLAB, it finds TWO such function, both of which lie below the graphfun directory, so are methods for graph and digraph objects.
On your computer, I predict that you have written a script called nearest.m, then saved it on your search path. DON'T DO THAT!!!!!!!!
To fix the problem, name it something else. And avoid naming scripts with the names of useful functions in the future.