What happens if we swap these two components?
Because you (the book) have defined the direction what the branch currents then the mesh currents add/subtract so that you maintain the direction of the branch current. (That sounds a bit confusing).

Look at branch current ig for example. It passes through element g. It's direction is fixed - it goes down through element g. 

Now look at mesh current i3. Does it also pass through element g ? It does. It goes down through element g. But what about mesh current i2 ? It also passes through element g however it goes up through element g. The direction of the branch current ig is already defined - down. So if we were to add up i3 and i2 together, their net sum must be in the direction of the branch current. 

So ig = i3-i2.

If you had chosen the current ig to going up instead initially, then ig = i2 - i3.

It doesnt matter how you initally set up your directions, so long as you lock it in and dont change directions, the math will work itself out.

Hopefully that helped and give you enough to answer your own question.