Cram a bunch of people from different parts of the world into a flying tin can, recycle the air in the cabin, and you've got a pretty solid recipe for helping the spread of various infections.

Air travel is an efficient way to transport both people and diseases. But now researchers have finally come up with the most optimal method for limiting infection rates.

When you return home from vacation with a nasty bug, several factors will have led to that unlucky moment - from aircraft cabin air quality to flight duration, contact with other people, waiting time in boarding queues and more.

According to the World Health Organisation (WHO), even though aeroplanes use up to 50 percent recycled air, it is supposed to go through efficient filters that should trap pathogens such as bacteria, fungi, and viruses.

But despite these precautions, it's the prolonged close contact with other potentially diseased humans that makes air travel more of a disease risk.

And according to a new study lead by researchers from Arizona State University, the way we board and distribute people on planes can make a big difference.

"There is direct evidence for the spread of infection within commercial airplanes for many infectious diseases including influenza, SARS, tuberculosis, measles, and norovirus," they write in the study.

Now, just sitting next to someone who is flu-ridden is not automatically going to get you sick - there's a lot of randomness involved here, which mathematicians refer to as stochasticity.

To study the spread of infectious diseases, researchers use stochastic infection models. In this case, the team combined such a model with one that measures "pedestrian dynamics" - the movements of passengers as they board, settle into their seats, and later deplane.

These dynamics have been investigated before, but with optimisation in mind - to cut down on boarding and arrival times for travellers by using different boarding strategies.

As a case study, the team applied their hybrid model to a hypothetical case of an Ebola infection, so see how this close-contact disease might propagate through a plane depending on the chosen strategy.

"We consider the situation with one infected individual with Ebola traveling on a commercial airplane," the team writes in the study.

"The infective passenger onboard is not identifiable; therefore, we varied the seating position of the infected individual through all the seats in the aeroplane."

So what's the best way to seat a plane if you don't want most of your passengers to end up with Ebola?

Surprisingly, it's not the strategy commonly used by airlines, where the people are asked to board in three sections from the front of the plane to the middle and then back - passengers end up standing packed in the aisles, increasing close contact time.

The best way, according to the data, is to split the plane into only two sections and then randomly board the passengers within these - this drops the infection risk to 40 percent as opposed to the 67 percent risk if we use the classic three-section strategy.

The team ran the model on several common passenger planes, and this held true for all of them, from smaller to larger.

But plane size does have an effect too, which is super useful to know. The researchers found that smaller planes - with fewer than 150 seats - are better at reducing infection rates, as there are fewer passengers present, less time spent getting to your seat, and a smaller radius for the diseased person to spread their germs.

"Using smaller airplanes during an outbreak, instead of completely banning flights to a specific destination, can drastically reduce the probability of introduction of infection," says one of the team, Anuj Mubayi from Arizona State University.

And even if you're not worried about an Ebola outbreak, the best part of this new model is that it can easily be adapted to other close-contact diseases such as the flu and the common cold.

"The modelling approach developed here is generic and can be readily modified to other directly transmitted infectious diseases and dense pedestrian spaces," the researchers conclude.

Now all they need to do is convince airlines to listen to science so that they can save us all from getting sick at the worst possible time - during holidays.

The study was published in Physical Review Letters E.