What exactly is "connectivity" between pixels in an image?

So, my professor says that two pixels are connected if:

1. they are neighbours; and
2. their intensities satisfy a specified criterion of similarity.

And depending on the type of neighbours they are, they can be 4-, 8- or m-connected.

But the book I'm following, by Gonzalez and Woods, says the following about connectivity:

Let S represent a subset of pixels in an image. Two pixels p and q are said to be connected in S if there exists a path between them consisting entirely of pixels in S.

Now, if I understand what a "path" is, then according to the book, two pixels can be connected even if they're not neighbours and are still connected by a path. This directly contradicts the first condition in my professor's definition.

Is one of them wrong? What am I missing?

In short, there is on the one hand a pair-wise definition: two pixels are "simply" connected when they fulfill certain conditions on pixel spatial adjacency and/or brightness. Typically, for pixels of intensity $$I_{m,n}$$, they can be said connected locally if $$|m-m'|\le 1$$ and $$|n-n'|\le 1$$ (for the 8-topology, or $$|I_{m,n}-I_{m',n'}|\le 1$$ if you allow a non-local valued difference.