Equations of Power Flow Between Buses
The only difference between the formulations is the convention used. The first one assumes that power flowing out of the bus is positive, the second one assumes that power flowing into the bus is positive.

Since you will find the state that gives a certain power flow, the specified power injections' signs will depend on which convention you are using.