You know that dog biscuit shaped like a bone but made mostly of wheat? Your dog’s willingness to eat that treat, instead of going for a bone in your thigh, helps explain how its ancestors evolved from wolves into house pets.

A team of Swedish researchers compared the genomes of wolves and dogs and found that a big difference is dogs’ ability to easily digest starch. On their way from pack-hunting carnivore to fireside companion, dogs learned to desire — or at least live on — wheat, rice, barley, corn and potatoes.

As it turns out, the same thing happened to humans as they came out of the forest, invented agriculture and settled into diets rich in grains.

“I think it is a striking case of co-evolution,” said Erik Axelsson, a geneticist at Uppsala University. “The fact that we shared a similar environment in the last 10,000 years caused a similar adaptation. And the big change in the environment was the development of agriculture.”

The findings, published Wednesday in the journal Nature, support the hypothesis that dogs evolved from wolves who found a new food source in refuse on the outskirts of human settlements. Eventually they came to tolerate human contact and were brought into the household to be guards, workers and companions.

Another theory is that wolves were captured by hunter-gatherers, who tamed, bred and eventually settled down with them.

Dog evolution is a contentious subject, and the new findings are unlikely to settle the debate. Among the uncertainties is when some wolves began to evolve into dogs.

Human-tolerant — if not fully domesticated — canids may have existed as many as 33,000 years ago. Archaeological remains reveal dogs and humans sharing the same graves 11,000 years ago. That was at the dawn of agriculture; the two species appear to have been at least acquaintances by then.

“Pretty much everyone without an agenda agrees that we don’t really have a good handle about why wolves domesticated into dogs when they did,” said Adam Boyko, a geneticist at Cornell University who studies dog evolution and was not involved in the new research. “But it does seem reasonable, and in agreement with the fossil and genetic record, that it could have predated agriculture somewhat.”

The evidence of natural selection in the number and efficiency of key digestive enzymes supports the hypothesis that dogs may have domesticated themselves as a way to exploit the garbage of permanent human settlements.

“Humans had nothing to do with it,” said Raymond Coppinger, an emeritus professor of biology and expert on dog evolution at Hampshire College in Massachusetts. “There was a new niche that was all of a sudden available for somebody to move into. Dogs are selected to scavenge off people.”

Accompanying the dietary change — and probably evolving along with it — were behavior changes that allowed dogs to tolerate living near people and ultimately being adopted by them. The Swedish researchers found strong evidence of genetic differences in brain function — and particularly brain development — between wolves and dogs, which they have not yet analyzed.

In the new study, Axelsson and his colleagues examined DNA from 12 wolves and 60 dogs. The wolf samples were from animals from the United States, Sweden, Russia, Canada and several other northern countries. The dogs were from 14 breeds.

The researchers compared the DNA sequences of the wolves and the dogs (which are subspecies of the same species, Canis lupus) and identified 36 genomic regions in which there are differences that suggest they have undergone recent natural selection in dogs.

In particular, dogs show changes in genes governing three key steps in the digestion of starch. The first is the breakdown of large carbohydrate molecules into smaller pieces; the second is the chopping of those pieces into sugar molecules; the third is the absorption of those molecules in the intestine.

“It is such a strong signal that it makes us convinced that being able to digest starch efficiently was crucial to dogs. It must have been something that determined whether you were a successful dog or not,” Axelsson said.

The change is at least partly the consequence of dogs having multiple copies of a gene for amylase, an enzyme made by the pancreas that is involved in the first step of starch digestion. Wolves have two copies; dogs have four to 30.

As it happens, amylase “gene duplication” is also a feature of human evolution. Humans carry more copies of the amylase gene than their primate ancestors. People also produce the enzyme in saliva, which allows the first steps of digestion to occur while food is still in the mouth. That, in turn, rewards chewing and increases the palatability of food.

In dogs, however, the increased amylase activity occurs only in the pancreas. The enzyme isn’t at work in their mouths, probably because the food doesn’t stay there long enough. Dogs may be able to eat human food, but they still wolf it down.

The researchers found 19 genome regions containing nervous system genes that are significantly different between wolves and dogs. Eight regions contain genes governing brain development.

How those genetic mutations explain dog behavior is a topic of future research. However, the fact that so many are involved in brain maturation supports the theory that dogs are really wolves that never grew up.

Sociability around strangers, curiosity and playfulness are traits seen in both wolf pups and dog pups. So are floppy ears, broader faces and liberal tail-wagging. They all persist in adult dogs but are largely extinguished in adult wolves.

This retention of juvenile traits into adulthood — a phenomenon known as “neoteny” — is a key feature of domestication, some biologists believe. In a famous four-decade, 40-generation experiment in Russia, these traits emerged in foxes when scientists selectively bred the animals for tameness.

But the process may not require human intervention. Similar behavior probably evolved naturally in dogs. The willingness to wander fearlessly among people is a big plus if scavenging human food is your business (as it still is for millions of “village dogs” around the world).

There’s a theory that this “self-domestication” also happened in the evolution of Homo sapiens.

As people created permanent settlements — and running away from those you didn’t like (or killing them) became less of an option — there may have been a survival advantage to being cooperative and self-controlled. It’s possible that studying the genes that determine dog sociability might shed light on how a less aggressive, more civilized human evolved, Axelsson said.

It would also help explain why dog is man’s best friend. They grew up together.