Whether “The Social Network” defines its generation I don’t know, but it isn’t a stretch to say that social networking itself does. People who came of age in the online era are accustomed to the Internet playing a significant role in almost every aspect of their social lives, to the extent that the way humans interact with each other is now vastly different from the way it was just 20 years ago. “The Social Network,” ostensibly about the founding of Facebook, is really about how the millennial generation functions.

Maybe anthropologists decades from now will use this movie to help them understand the generation of Americans born in the 1980s. If they do, I hope they’re as entertained by it as I was. With a crackling and sharp-witted screenplay by Aaron Sorkin (based on Ben Mezrich’s book “The Accidental Billionaires”) and fluid, energetic direction by David Fincher, “The Social Network” has all the stuff of a Shakespearean history play: the intrigue of professional backstabbing, the tragedy of broken friendships, and the exhilaration of changing history.

We begin in 2003, as Harvard sophomore Mark Zuckerberg (Jesse Eisenberg), an intense and ambitious computer nerd, is looking for a way to distinguish himself in a place where everyone got 1600 on their SATs. His girlfriend, Erica (Rooney Mara), can’t keep up with his nervous worrying, his constant plotting, the frantic pace of his thought process (“Dating you is like dating a Stairmaster,” she says), and the first scene of the movie culminates in their breaking up. “You’re going to go through life thinking that girls don’t like you because you’re a geek,” she tells him. “And I want you to know, from the bottom of my heart, that that won’t be true. It’ll be because you’re an a**hole.”

That about sums it up. Mark isn’t mean (no more so than the typical 19-year-old male, anyway), but he’s too smart, too jealous, and too insecure for his own good. After using his blog to lash out at Erica for dumping him, his mind returns to a subject that frequently occupies it: exclusivity. He already attends the country’s most elite university and wants to join one of the university’s most elite social clubs. Now he envisions a dating website specifically for Harvard students. Mark has an insatiable need to use whatever advantage he has to get ahead, and the “@harvard.edu” at the end of an e-mail address is awfully impressive to a lot of girls.

The film jumps back and forth between two time periods. One is 2003-2004, when Facebook is being created and becoming a phenomenon practically overnight. The other is a few years later, when Mark is the defendant in two separate lawsuits. His former best friend and business partner, Eduardo Saverin (Andrew Garfield), is suing for what he feels is his rightful share of Facebook. Identical twins Cameron and Tyler Winklevoss (both played by Armie Hammer, with help from a body double) and their friend Divya Narendra (Max Minghella) are suing because they claim they hired Mark to build something like Facebook and he stole their idea.

In the depositions, Mark is as precise and imperious as he is in daily life, speaking in the crisp tones of a man who believes he is not just the smartest person in the room but perhaps the only smart person in the room. Jesse Eisenberg may have been born to play this role, and Aaron Sorkin — of TV’s famously verbose “West Wing” — may have been born to write it. Mark comes across as an a**hole, definitely, and yet we understand him. We sense his insecurities, his Facebookian desire to be “liked” and to be someone’s “friend,” the way he is automatically defensive in the presence of the hulking and athletic Winklevoss twins. The tragedy is in how Mark lets these desires consume him, to the point where his need for acceptance causes him to act in ways that are bound to prevent it. He wants so badly to be liked that he becomes unlikable.

Mark and Eduardo first begin to clash over Sean Parker (an effortlessly smooth Justin Timberlake), the co-founder of Napster, who comes along to help them take Facebook to the next level. Sean is a mover and shaker, a paranoid businessman who, like many young people who suddenly achieve wealth, believes that nothing is ever his fault. Eduardo, meanwhile, is sensitive and soft-spoken, even naive. He’s not suited for the cutthroat world of entrepreneurs, and indeed had no idea that’s what he was in for when he agreed to help Mark fund Facebook.

David Fincher, with help from Sorkin’s fast-moving script and Trent Reznor’s pumped-up musical score, achieves the near-impossible by making countless scenes of people typing on computer keyboards riveting. You wouldn’t think a movie about the creation of a website could be so enthralling, insightful, funny, and complex, but here we are. And maybe it does makes sense. Shakespeare and the ancient tragedians wrote about kings because their world was greatly affected by them. Why shouldn’t the same tragic themes of loyalty, greed, and human frailty be applied to the new, Internet-dominated world?