Graph databases · UC Berkeley DATASCI 205

Who really connects a social network?

We loaded Stanford's SNAP Facebook Social Circles network into Neo4j, added an engagement layer of posts and likes, and used graph algorithms to find the users a campaign should target to maximize reach.

Kala Fejzo, Prince Hossain & Chul Park View code on GitHub →
4,039
users
84,243
friendships
193
ground-truth friend circles
0.53
avg. clustering coefficient

The network

The 3,927 users in the main connected component, positioned by a force-directed layout. Hover a node for details.

Most-connected users

Degree centrality: number of friendships, top 10

These hubs reach the most people directly, so they're natural candidates for seeding a campaign.

Top bridge users

Betweenness centrality: share of shortest paths through each user, top 10

User 1085 sits on 24% of all shortest paths but has only 64 friends. Bridges carry information between communities.

Popular isn't the same as pivotal

Every user: number of friends vs. betweenness centrality

Degree and betweenness are almost uncorrelated (r = 0.10). None of the top-10 hubs is a top-10 bridge, so a reach campaign should target both groups.

How far apart are users?

Average shortest-path length from each ego user to everyone they can reach

Most users are about 4 hops from the central ego users. Lower values mean a more central starting point for spreading content.

Graph model in Neo4j

Three node types, four relationship types

6,619posts
18,005likes
2.7likes per post

Right database for each job

We also scoped how a social platform would split data across database types.

Relationships

Neo4j

Friendships, circles and engagement as a graph, so community detection, influencer search and shortest paths run natively.

Content

MongoDB

User profiles, posts and comments as flexible documents. The schema can change without migrations.

Speed

Redis

In-memory cache for trending posts and popular users, so high-traffic feed lookups stay fast.