You are obligated to converse with the people on each side of you at a formal dinner. It would be rude to sit next to someone and not speak with them.
1) If the people seated next to you are strangers, introduce yourself.
2) Divide your conversations equally between the people on each side of you – even if you have more of a connection with one than the other. You would not want to be the one left out of a conversation if you were in the other person’s position, would you?