Is there a way to get all addresses from an Wallet? If I was to search the blockchain for address X, then I see that it has two inputs in a transaction, X and Y.

I can safely assume that X and Y are owned by the same person?

Now if I look at all of the transactions for Y, and I see that it has a transaction with two outputs, Y and Z.

Then I can now assume that X, Y and Z are all owned by the same person, right?

If a wallet has 10 addresses, then could I not get all of those addresses using the above method?

So I essentially assume that, all inputs and outputs belong to the same person for a given address lookup.

Also, if X is both on the input and the output, then it is safe to assume that X being on the output was just used as a change address.
If I was to search the blockchain for address X, then I see that it has two inputs in a transaction, X and Y.
I can safely assume that X and Y are owned by the same person?

That's usually the case, but not always.  They could be owned by different people who have cooperated.  It is possible to do this in such a way that neither party reveals their private key to the other.

Now if I look at all of the transactions for Y, and I see that it has a transaction with two outputs, Y and Z.
Then I can now assume that X, Y and Z are all owned by the same person, right?

No, that's not a good assumption.  When a transaction has two outputs, there is no reason to think they both belong to the same person.  In fact, a more common case for two-output transactions is that one of the outputs is the &quot;real&quot; payment, and the other is &quot;change&quot; that goes back to another address belonging to the same person who sent the payment.  (See How does change work in a bitcoin transaction?)  However, there is no way to be sure which is which.

If a wallet has 10 addresses, then could I not get all of those addresses using the above method?

Nope.  If you continue in this way, you'll pull in a vast number of addresses belonging to different people who were paid by your initial target (and people who were paid by them, etc, etc).  You'll also miss any addresses from the wallet that have been used independently, if they've never appeared together in a transaction with any of the other ones you saw.