One of the biggest questions unfortunately that I believe is researched online, is whether a marriage/relationship can survive an affair. This is a very difficult question with no right answer. There are many reasons why affairs happen. To understand if you can fix the relationship, you need to know why the affair happened. Do not try to ask the cheater why they cheated. I will guarantee they will say they do not know. They are not protecting your feelings, they probably really do not know. If they did, there could have been a solution before the damage was done.
The main reasons why affairs happen is because someone is not being honest. It has nothing to do with love. Someone can love you more than they love themselves, but it doesn't change the possibility of an affair. If there is something in a relationship, whether it be lack of attention, money issues, stress at work, really anything that someone does not know how to deal with properly, it can result in an affair. Used as a second life the affair creates a type of fantasy land, these relationships can be saved. The main requirement to save the relationship is to find what the cause was. If it is stress, you need to retrain both of you how to openly communicate so that the stress can be relieved. If it is attention, a relationship needs a minimum of 15 hours per week of attention in order to survive. This is a requirement. Anything shy of this is putting a strain on your relationship. The time can be spent doing just about anything from grocery shopping to paying bills, but it needs to be done together. By keeping to this schedule, you will continue to grow together and not apart.
The other kind of affair is sex addicts. This is about 2% of the population. I will say it is very unlikely that this relationship can be saved. Not impossible, but unlikely. The person who was cheated on will always suspect that the addiction has resurfaced, and the addicted will always worry about a relapse.
Now there are a few scenarios that one person was at a party, and it just happened. This person is not ready for a relationship. To allow something casually to just happen is careless. If it is a longer affair, it is because someone is trying to fill a void. Whatever that void may be. That is where a relationship has potential to be strongr than ever, because if you fill the void that has always been present, you have a foundation that is stronger than anyone could imagine.
Sex really has nothing to do with most affairs. Don't believe me? Shania Twain's husband cheated on her, do you know any man who finds her unattractive? The sex can be for an intimacy issue, for pure excitement, or even an issue stemming from childhood. But whatever the issue, it is not generally for the sex itself.
If you have been involved in an affair, whether the cheater or cheated and you want to save your relationship. The first step is forgiveness. Seek a mediator, a counselor or psychiatrists to help sort out all the emotions. Put it past you, and rebuild. It will be a long hard road, but statistics show, it is in fact worth the haul.