(CNN) -- If you're feeling great today, you may end up inadvertently spreading the joy to someone you don't even know.

This network from 2000, colored for average mood, shows yellow as happy, blue as sad, and green as in-between.

New research shows that in a social network, happiness spreads among people up to three degrees removed from one another. That means when you feel happy, a friend of a friend of a friend has a slightly higher likelihood of feeling happy too.

The lesson is that taking control of your own happiness can positively affect others, says James Fowler, co-author of the study and professor of political science at the University of California in San Diego.

"We get this chain reaction in happiness that I think increases the stakes in terms of us trying to shape our own moods to make sure we have a positive impact on people we know and love," he said. Watch more on how happiness spreads »

Sadness also spreads in a network, but not as quickly, the researchers found. Each happy friend increases your own chance of being happy by 9 percent, whereas each unhappy friend decreases it by 7 percent. This reflects the total effect of all social contacts.

When framing the question differently, the study found that you are 15 percent more likely to be happy if a direct connection is happy, 10 percent if the friend of a friend is happy, and 6 percent if it's a friend of a friend of a friend.

The study, published in the British Medical Journal, used data from the Framingham Heart Study to recreate a network of 4,739. Fowler and co-author Dr. Nicholas Christakis of Harvard Medical School charted friends, spouses and siblings in the network, and used their self-reported happiness ratings from 1983 to 2003.

Don't Miss

Daniel Gilbert, professor of psychology at Harvard University and author of "Stumbling on Happiness," called the study "a stunning paper by two of the most respected scientists in the field" in a statement he e-mailed to CNN.

"We've known for some time that social relationships are the best predictor of human happiness, and this paper shows that the effect is much more powerful than anyone realized," Gilbert said. "It is sometimes said that you can't be happier than your least happy child. It is truly amazing to discover that when you replace the word 'child' with 'best friend's neighbor's uncle,' the sentence is still true."

If you are the hub of a large network of people -- that is, if you have a lot of connected friends or a wide social circle -- you are more likely to become happy, the study found.

But the reverse is not true.

"You might only have one friend or two friends or something like that, and if you become happy, you're not going to try to get more friends. You're probably going to stick with what worked in the first place," Fowler said.

The researchers are also looking at the phenomenon on Facebook, which has more than 120 million active users. This study, which has not yet been published, looked at who smiles in their profile pictures who doesn't, and whether their connections also smile or not, Fowler said.

"We find smiling profiles cluster in much the same way as happiness is clustering in the Framingham Heart Study," he said.

Health Library

It's not just happiness that spreads in a social network. Fowler and Christakis have also looked at trends in cigarette smoking and obesity using the parts of the heart study network.

They found that when someone quits, a friend's likelihood of quitting smoking was 36 percent. Moreover, clusters of people who may not know one another gave up smoking around the same time, the authors showed in a New England Journal of Medicine article in May.

Social ties also affect obesity. A person's likelihood of becoming obese increased by 57 percent if he or she had a friend who became obese in a given time period, Fowler and Christakis showed in a paper in the New England Journal of Medicine in July 2007.

And, like happiness, both smoking behavior and obesity seem to spread within three degrees of separation in a social network, Fowler said. Beyond three, things get fuzzier.

"Eventually you get out far enough in the social network that you're competing with all these other cascades of happiness and unhappiness that are sort of duking it out," he said. "Happiness on average wins, but once you get far enough away from someone in a social network, it's not possible to detect their effect anymore."