1 of 68

AMITY UNIVERSITY KOLKATA · CSIT406 · 3 CREDITS · UG

Social Media

Analytics

From network foundations and data pipelines to machine learning, tools and a hands-on capstone.

Dr. Indraneel Mukhopadhyay

Amity Institute of Information Technology, Amity University Kolkata

Complete classroom & self-study deck · 300 slides · Fully aligned to the CSIT406 syllabus

2 of 68

CORE SYLLABUS

COURSE SNAPSHOT

CSIT406 — Social Media Analytics at a Glance

CSIT406

Course code · Undergraduate elective

3

Credit units (Theory L/T · 100%)

5

Modules across the syllabus

40:60

Internal assessment : End-term exam

A theory-and-practice course that takes you from the structure of social networks to machine-learning-driven insight and a hands-on Python capstone.

Course Overview

CSIT406 · Social Media Analytics

2

3 of 68

CORE SYLLABUS

COURSE OBJECTIVES

What This Course Sets Out to Do

Straight from the CSIT406 syllabus — three guiding objectives frame everything that follows.

Understand the fundamentals of social networks

Build a solid grasp of the concepts and theories behind how people, organisations and content connect.

Explore different network structures

Study small-world networks, scale-free networks and random graphs — the archetypes that describe real systems.

Analyse real-world networks

Apply the techniques to social, technological and biological networks and extract meaningful, decision-ready insight.

Course Overview

CSIT406 · Social Media Analytics

3

4 of 68

CORE SYLLABUS

COURSE LEARNING OUTCOMES

By the End of CSIT406, You Will Be Able To…

1

Develop semantic-web applications

Model and build applications that use the linked, machine-readable structure of the social web.

2

Represent knowledge with ontology

Capture entities, relationships and meaning using ontologies and structured knowledge models.

3

Describe web communities

Detect, characterise and explain the communities that emerge within online social systems.

4

Predict behaviour on the social web

Use analytics and models to anticipate how users and communities will act and react.

5

Visualise social networks

Turn complex network data into clear, interpretable visual stories that drive decisions.

Mapped throughout

Every module explicitly connects back to these five outcomes — see the wrap-up for the full mapping.

Course Overview

CSIT406 · Social Media Analytics

4

5 of 68

DEEPER DIVE

PREREQUISITES

What You Should Bring to the Course

The syllabus assumes a working foundation in four areas. A quick refresher on any of these will pay off.

Mathematical foundations

Sets, matrices, basic probability and an intuition for graphs.

Programming skills

Comfort with Python — data structures, functions and libraries.

Data science & ML basics

Familiarity with datasets, features and elementary models.

Social & behavioural concepts

A feel for how people, groups and influence work socially.

Course Overview

CSIT406 · Social Media Analytics

5

6 of 68

CORE SYLLABUS

SYLLABUS BLUEPRINT

The Five Modules and Their Weightage

Proportional design

These slides are distributed to match weightage, complexity and expected teaching hours — not padded to a number.

ML is the heaviest

Module IV (25%) receives the most slides; Module II (15%) the fewest, mirroring the syllabus.

Sequence preserved

The deck follows the exact module and topic order given in the syllabus.

Course Overview

CSIT406 · Social Media Analytics

6

7 of 68

CORE SYLLABUS

LEARNING ROADMAP

Your Journey Through the Course

1

Module I — Foundations

Platforms, evolution & impact, network structures, key metrics and graph theory.

2

Module II — Data

Collecting data via APIs, scraping and datasets; ethics; preprocessing; sentiment; noisy data.

3

Module III — Analysis

Graph representation, community detection, link prediction, influence & diffusion, viral spread.

4

Module IV — Intelligence

Supervised/unsupervised ML, sentiment classification, fake-news detection, recommenders, bots.

5

Module V — Practice

NetworkX, Gephi, Tweepy, Scrapy, sentiment APIs, hands-on projects and a Python capstone.

Course Overview

CSIT406 · Social Media Analytics

7

8 of 68

DEEPER DIVE

HOW THIS COURSE IS TAUGHT

Pedagogy for Course Delivery

Lecture-based learning

Structured explanation of concepts, theory and worked reasoning.

Hands-on programming & tool-based learning

Live coding and tool practice with Python, NetworkX, Gephi, Tweepy and more.

Case studies & real-world applications

Real campaigns, movements and datasets that ground the theory.

Collaborative learning & group activities

Team projects, peer analysis and discussion of findings.

Industry & research exposure

Current tools, papers and practices from industry and academia.

Course Overview

CSIT406 · Social Media Analytics

8

9 of 68

CORE SYLLABUS

ASSESSMENT SCHEME

How You Are Assessed

Continuous assessment — 40%

Class Test 10% · Home Assignment 20% · Viva 5% · Attendance 5%.

End-term examination — 60%

A single written exam (Theory L/T, 100% theory) covering the full syllabus.

Plan accordingly

Assignments and the exam dominate your grade — engage with the practicals early.

Course Overview

CSIT406 · Social Media Analytics

9

10 of 68

DEEPER DIVE

PRESCRIBED READING

Texts & References

Text · Social Networks and the Semantic Web

Peter Mika, 1st Edition, Springer, 2007. Core text for the semantic-web and knowledge-representation outcomes.

Text · Handbook of Social Network Technologies & Applications

Borko Furht, 1st Edition, Springer, 2010. Breadth reference across technologies and applications.

Ref · Social Information Retrieval Systems

Dion Goh & Schubert Foo, IGI Global, 2008. Emerging technologies for searching the web effectively.

Ref · Web Mining and Social Networking

Guandong Xu, Yanchun Zhang & Lin Li, 1st Edition, Springer, 2011. Techniques and applications of web mining.

Course Overview

CSIT406 · Social Media Analytics

10

11 of 68

DEEPER DIVE

HOW TO READ THIS DECK

A Colour-Coded Legend for Every Slide

Each content slide carries a tag in the top-right corner so you always know what kind of material you are looking at.

Core Syllabus

Content taken directly from the CSIT406 syllabus — the examinable backbone of the course.

Deeper Dive

Additional explanatory content from reliable academic/industry sources to make core ideas click.

Worked Example

Step-by-step examples that show a concept or algorithm in action on concrete data.

Case Study

Real-world stories and campaigns that ground the theory in practice.

Practical

Hands-on code and tool walkthroughs you can run yourself in Python.

Always aligned

Additional material never drifts from the syllabus — it only supports and illustrates it.

Course Overview

CSIT406 · Social Media Analytics

11

12 of 68

PRACTICAL

GETTING STARTED

How to Get the Most from This Course

Run every practical

Type out and execute the Python examples — analytics is a doing discipline, not a reading one.

Connect theory to cases

For each algorithm, ask “where have I seen this on a real platform?” The case studies help.

Build toward the capstone

Treat mini-projects as rehearsals for the Module V capstone; reuse your own code.

Stay ethical & legal

Respect platform terms, privacy and the DPDP Act 2023 in everything you collect and analyse.

Course Overview

CSIT406 · Social Media Analytics

12

13 of 68

I

MODULE

WEIGHTAGE · 20%

Introduction to Social Media & Networks

IN THIS MODULE

  • Overview of social media platforms
  • Evolution & impact on society, business, politics
  • Basics of social network structures
  • Key metrics: centrality, density, clustering
  • Graph theory & its application to networks

13

14 of 68

CORE SYLLABUS

MODULE I · LEARNING OUTCOMES

What You Will Be Able to Do

Classify the social-media landscape

Identify major platforms and the forms of interaction each supports.

Explain social media’s impact

Trace its evolution and effect on society, business and politics.

Model networks as graphs

Represent actors and ties with nodes, edges and the right graph type.

Compute key network metrics

Measure centrality, density and clustering, and interpret what they mean.

Apply graph theory to social networks

Use graph concepts and structural models to reason about real systems.

Module I · Introduction to Social Media & Networks

CSIT406 · Social Media Analytics

14

15 of 68

CORE SYLLABUS

FOUNDATIONS

What Is Social Media?

DEFINITION

Social media is the use of electronic and Internet tools to create, share and discuss information, opinions and experiences with other people in participatory, many-to-many ways.

People-centred

Users, not publishers, generate most of the content and the connections.

Two-way

It is a conversation and a network, not a one-way broadcast channel.

Data-rich

Every post, like, follow and share is a data point we can analyse.

Module I · Introduction to Social Media & Networks

CSIT406 · Social Media Analytics

15

16 of 68

CORE SYLLABUS

FOUNDATIONS

What Is Social Media Analytics?

DEFINITION

Social media analytics is the practice of representing, measuring and extracting meaningful patterns from social-media data to inform understanding and decisions.

Represent

Turn raw posts, users and ties into structured, computable form.

Analyse

Apply statistics, graph theory and machine-learning algorithms.

Extract insight

Surface communities, influence, sentiment and behaviour.

Module I · Introduction to Social Media & Networks

CSIT406 · Social Media Analytics

16

17 of 68

DEEPER DIVE

CLARIFYING THE LANDSCAPE

Data vs. Analytics vs. Listening

Social Media Data

The raw “what”: clicks, likes, impressions, follower counts and posts — unprocessed facts and numbers.

Social Media Analytics

The “how it performs”: quantitative collection and interpretation into engagement rates, demographics and conversions.

Social Media Listening

The “how they feel”: qualitative analysis of conversations — sentiment, trends and reputation.

Module I · Introduction to Social Media & Networks

CSIT406 · Social Media Analytics

17

18 of 68

DEEPER DIVE

WHY IT MATTERS

The Business & Research Value

Brand reputation

Monitor how a brand or figure is perceived and respond quickly.

Audience mastery

Understand who the audience is and what they care about.

Trendspotting

Detect emerging topics before they peak.

Competitive edge

Benchmark share of voice against rivals.

Content optimisation

Learn what content resonates and double down.

Customer experience

Spot complaints and serve customers in real time.

Module I · Introduction to Social Media & Networks

CSIT406 · Social Media Analytics

18

19 of 68

CORE SYLLABUS

OVERVIEW OF PLATFORMS

The Social-Media Landscape

Social media takes many forms — each a different way to create, share and discuss content.

Social networking

Connect with people — Facebook, LinkedIn.

Microblogging

Short, fast posts — X/Twitter.

Blogging

Long-form writing — WordPress, Medium.

Media sharing

Video & images — YouTube, Instagram, Flickr.

Social news

Vote-ranked stories — Reddit, Digg.

Wikis

Collaborative knowledge — Wikipedia.

Social bookmarking

Save & tag links — Pinterest, Delicious.

Reviews & ratings

Opinions on things — Yelp, TripAdvisor.

Q&A communities

Ask & answer — Quora, Stack Exchange.

Module I · Introduction to Social Media & Networks

CSIT406 · Social Media Analytics

19

20 of 68

CORE SYLLABUS

SCALE OF THE PHENOMENON

Social Media by the Numbers

5B+

Social-media user identities worldwide

~60%

Of the global population is on social media

2h+

Average daily time spent per user

7+

Average number of platforms used monthly

Figures are indicative industry estimates (DataReportal-style order of magnitude). The point is scale: social platforms are now a primary layer of human communication — and a vast data source.

Module I · Introduction to Social Media & Networks

CSIT406 · Social Media Analytics

20

21 of 68

CORE SYLLABUS

PLATFORM PROFILE

Facebook

The prototypical online social network: bidirectional friendships and a feed of mixed content.

Structure

Undirected “friend” ties form a symmetric social graph; groups and pages add community layers.

Interactions

Posts, reactions, comments, shares and messaging generate rich engagement signals.

Analytics value

Demographics, reach, engagement and ad performance via the Graph API and Meta Insights.

Use cases

Community building, targeted advertising, customer service and event promotion.

Module I · Introduction to Social Media & Networks

CSIT406 · Social Media Analytics

21

22 of 68

CORE SYLLABUS

PLATFORM PROFILE

X (formerly Twitter)

A microblogging platform built for real-time, public, short-form conversation.

Structure

Directed “follow” ties — you can follow without being followed back — creating an asymmetric graph.

Interactions

Tweets, retweets, replies, quotes, likes, hashtags and mentions spread information fast.

Analytics value

The classic dataset for trend analysis, sentiment, diffusion and influencer studies.

Use cases

Breaking news, brand voice, live events, public opinion and citizen journalism.

Module I · Introduction to Social Media & Networks

CSIT406 · Social Media Analytics

22

23 of 68

CORE SYLLABUS

PLATFORM PROFILE

LinkedIn

The professional network — a graph of careers, skills and business relationships.

Structure

Connections are mutual professional ties; “follow” allows one-way influence too.

Interactions

Posts, articles, endorsements, recommendations and job interactions.

Analytics value

Talent trends, B2B reach, skill graphs and professional community detection.

Use cases

Recruitment, employer branding, thought leadership and B2B marketing.

Module I · Introduction to Social Media & Networks

CSIT406 · Social Media Analytics

23

24 of 68

CORE SYLLABUS

PLATFORM PROFILE

Instagram

A visual-first media-sharing network centred on images, reels and stories.

Structure

Directed follower graph like X, but organised around visual content and creators.

Interactions

Likes, comments, saves, shares, stories and reels drive high engagement.

Analytics value

Influencer reach, hashtag performance, visual-content trends and audience insights.

Use cases

Influencer marketing, brand aesthetics, e-commerce and creator economies.

Module I · Introduction to Social Media & Networks

CSIT406 · Social Media Analytics

24

25 of 68

CORE SYLLABUS

OVERVIEW OF PLATFORMS

Other Major Platforms

YouTube

Video sharing & watch-graph; subscriptions and recommendation-driven reach.

Reddit

Community-based forums (subreddits) with vote-ranked discussion.

TikTok

Short-video platform where an algorithmic feed dominates the follow graph.

WhatsApp

Encrypted messaging & groups — a largely private social graph.

Module I · Introduction to Social Media & Networks

CSIT406 · Social Media Analytics

25

26 of 68

DEEPER DIVE

COMPARING PLATFORMS

Platform Characteristics at a Glance

Platform

Graph type

Primary content

Analytics access

Best for

Facebook

Undirected

Mixed / text+media

Graph API, Insights

Community & ads

X / Twitter

Directed

Short text

X API (tiered)

Trends & diffusion

LinkedIn

Mutual + follow

Professional

Limited API

B2B & talent

Instagram

Directed

Images / reels

Graph API (business)

Influencers

YouTube

Subscribe

Video

YouTube Data API

Reach & retention

Reddit

Community

Threaded text

Reddit API (PRAW)

Niche communities

API access changes frequently and often requires approval or payment — always check current terms before building a data pipeline.

Module I · Introduction to Social Media & Networks

CSIT406 · Social Media Analytics

26

27 of 68

CORE SYLLABUS

THE NATURE OF SOCIAL MEDIA

Five Defining Characteristics

Participation

Encourages contribution and feedback; blurs media and audience.

Openness

Few barriers to voting, sharing and access.

Conversation

A two-way dialogue, not a broadcast.

Community

Communities form fast around shared interests.

Connectedness

Thrives on links to people, sites and resources.

Module I · Introduction to Social Media & Networks

CSIT406 · Social Media Analytics

27

28 of 68

CORE SYLLABUS

EVOLUTION

From the Read-Only Web to the Social Era

1

Web 1.0

Read-only pages. Users consume; few create. 1990s.

2

Web 2.0

Read–write web. User-generated content, blogs, wikis. Early 2000s.

3

Social era

Networked platforms — Facebook, Twitter, YouTube. 2004 onward.

4

Mobile & video

Smartphones, Instagram, TikTok; always-on, visual, algorithmic.

5

AI-mediated

Recommendation & generative AI shape what we see and create.

Module I · Introduction to Social Media & Networks

CSIT406 · Social Media Analytics

28

29 of 68

DEEPER DIVE

EVOLUTION

Key Milestones in Social Media

Year

Milestone

Why it mattered

1997

SixDegrees.com

First recognisable social-network site — profiles and friend lists.

2003

MySpace / LinkedIn

Mainstream social networking and professional networking begin.

2004

Facebook

Scales the social graph to billions; defines the modern feed.

2006

Twitter

Real-time microblogging; the hashtag and public conversation.

2010

Instagram

Mobile, visual, influencer-driven media sharing.

2016+

TikTok

Algorithmic short-video feed reshapes attention and discovery.

Module I · Introduction to Social Media & Networks

CSIT406 · Social Media Analytics

29

30 of 68

CORE SYLLABUS

EVOLUTION & IMPACT

Impact on Society

Communication

Instant, global, many-to-many communication across distance and language.

Social movements

Rapid mobilisation and awareness — hashtag activism and grassroots organising.

Culture & identity

New norms, communities, creators and modes of self-expression.

Information access

News now flows peer-to-peer, bypassing traditional gatekeepers.

Wellbeing

Effects on attention, comparison and mental health — a growing research area.

Misinformation

The same reach that spreads news also spreads rumour at scale.

Module I · Introduction to Social Media & Networks

CSIT406 · Social Media Analytics

30

31 of 68

CORE SYLLABUS

EVOLUTION & IMPACT

Impact on Business

Marketing

Targeted, measurable, two-way marketing replaces one-way advertising.

Social commerce

Discovery-to-purchase inside the platform; creators as storefronts.

Customer relations

Support, feedback and community management happen in public.

Market intelligence

Listening reveals demand, sentiment and competitor moves in real time.

Recruitment

Talent sourcing and employer branding, especially on LinkedIn.

Reputation risk

A single post can become a crisis — monitoring is now essential.

Module I · Introduction to Social Media & Networks

CSIT406 · Social Media Analytics

31

32 of 68

CORE SYLLABUS

EVOLUTION & IMPACT

Impact on Politics

Campaigns

Micro-targeted messaging, fundraising and voter mobilisation.

Mobilisation

Protests and movements coordinate and spread online.

Public discourse

Direct politician–citizen communication reshapes the public sphere.

Disinformation

Coordinated campaigns and bots attempt to sway opinion.

Echo chambers

Algorithmic curation can polarise and fragment the electorate.

Surveillance

Social data enables monitoring — raising civil-liberties concerns.

Module I · Introduction to Social Media & Networks

CSIT406 · Social Media Analytics

32

33 of 68

CASE STUDY

EVOLUTION & IMPACT

Case Study — Social Media & Collective Action

THE SITUATION

During the Arab Spring (2010–2012) and many later movements, platforms such as Twitter and Facebook were used to coordinate protests, share information past state media, and draw global attention within hours.

The network effect

Weak ties across communities carried information far beyond any single group — bridges mattered more than hubs.

Speed & reach

Hashtags aggregated dispersed voices into trends, making local events globally visible almost instantly.

The nuance

Platforms enabled coordination but did not cause events; later, the same tools were used for surveillance and counter-messaging.

Module I · Introduction to Social Media & Networks

CSIT406 · Social Media Analytics

33

34 of 68

DEEPER DIVE

A BALANCED VIEW

The Double-Edged Sword

The properties that make social media powerful also create its characteristic harms.

Misinformation at scale

Openness and virality let false claims spread faster than corrections.

Filter bubbles & polarisation

Personalisation can trap users in self-reinforcing viewpoints.

Privacy erosion

Rich behavioural data can be collected, combined and misused.

Attention & wellbeing

Engagement-optimised design can harm focus and mental health.

Module I · Introduction to Social Media & Networks

CSIT406 · Social Media Analytics

34

35 of 68

THE CENTRAL INSIGHT

Every post is a data point, every profile a node, and every follow, like or mention an edge. To analyse social media is to analyse a graph.

This is why the rest of Module I turns to networks and graph theory — the mathematical language of connection.

35

36 of 68

CORE SYLLABUS

NETWORK STRUCTURES

Modelling Social Media as a Network

THE CORE ABSTRACTION

A social network is a set of actors (people, organisations, accounts) connected by ties (relationships or interactions). Formally, it is a graph G = (V, E) of vertices V and edges E.

Actors → nodes

Each user or entity becomes a vertex in the graph.

Ties → edges

Friendships, follows, mentions or likes become edges.

Why a graph?

It exposes structure — hubs, communities, paths — invisible in a spreadsheet.

Module I · Introduction to Social Media & Networks

CSIT406 · Social Media Analytics

36

37 of 68

CORE SYLLABUS

GRAPH BASICS

Nodes — the Actors

Nodes (also called vertices or actors) are the entities in the network.

What a node represents

A person, account, organisation, page, hashtag or even a piece of content — whatever we choose to model.

Node attributes

Nodes carry data: age, location, follower count, join date — used later for prediction and segmentation.

Order of the graph

The number of nodes |V| is the order (size) of the graph.

Node types

A network may mix node types (users and groups) — giving a two-mode or heterogeneous network.

Module I · Introduction to Social Media & Networks

CSIT406 · Social Media Analytics

37

38 of 68

CORE SYLLABUS

GRAPH BASICS

Edges — the Ties

Edges (ties or relationships) connect nodes and encode how they relate.

What an edge represents

A friendship, follow, mention, reply, co-membership or interaction between two nodes.

Edge weight

Edges can carry a weight — frequency of contact, number of messages, strength of a tie.

Edge direction

Some ties are one-way (a follow); others are mutual (a friendship).

Size of the graph

The number of edges |E| is the size of the graph; adjacency means sharing an edge.

Module I · Introduction to Social Media & Networks

CSIT406 · Social Media Analytics

38

39 of 68

CORE SYLLABUS

GRAPH TYPES

Directed vs. Undirected Graphs

Directed graph

  • Edges have a direction (arcs): A → B ≠ B → A
  • Models asymmetric ties like “follows” on X/Instagram
  • Each node has an in-degree and an out-degree
  • In-degree ≈ followers; out-degree ≈ following
  • Enables ideas like PageRank and information flow

Undirected graph

  • Edges are symmetric: A – B means B – A
  • Models mutual ties like Facebook / LinkedIn “friends”
  • Each node simply has a degree
  • Simpler to analyse; many metrics assume this form
  • Often obtained by symmetrising a directed graph

Module I · Introduction to Social Media & Networks

CSIT406 · Social Media Analytics

39

40 of 68

CORE SYLLABUS

GRAPH TYPES

Weighted & Signed Graphs

Weighted graph

  • Each edge carries a numeric weight
  • Weight = strength, frequency, cost or capacity
  • e.g. number of messages exchanged between two users
  • Distinguishes strong ties from weak acquaintances
  • Needed for shortest-path and flow algorithms

Signed graph

  • Edges carry a sign: + or −
  • Positive = friend / trust; negative = foe / distrust
  • Used to study balance and conflict in networks
  • Structural balance: “the enemy of my enemy is my friend”
  • Common in review, rating and trust networks

Module I · Introduction to Social Media & Networks

CSIT406 · Social Media Analytics

40

41 of 68

CORE SYLLABUS

STRUCTURE

Degree, In-Degree & Out-Degree

DEGREE

The degree of a node is the number of edges attached to it. In a directed graph it splits into in-degree (incoming arcs) and out-degree (outgoing arcs).

In-degree

Incoming ties — e.g. how many followers an account has.

Out-degree

Outgoing ties — e.g. how many accounts a user follows.

Handshake lemma

The sum of all degrees equals 2 × |E|; the count of odd-degree nodes is always even.

Module I · Introduction to Social Media & Networks

CSIT406 · Social Media Analytics

41

42 of 68

CORE SYLLABUS

REPRESENTATION

Storing a Graph — Adjacency Matrix

ADJACENCY MATRIX

An n × n matrix A where A[i][j] = 1 (or the edge weight) if node i links to node j, and 0 otherwise. The diagonal marks self-loops.

Strengths

O(1) edge lookup; clean for linear-algebra methods and spectral analysis.

Weakness

Uses O(n²) space — wasteful for large, sparse social graphs.

Directed?

Symmetric matrix ⇒ undirected; asymmetric ⇒ directed graph.

Module I · Introduction to Social Media & Networks

CSIT406 · Social Media Analytics

42

43 of 68

CORE SYLLABUS

REPRESENTATION

Adjacency List & Edge List

Adjacency list

  • For each node, a list of its neighbours
  • Compact for sparse graphs — O(|V| + |E|) space
  • Fast to iterate a node’s neighbours
  • The default in libraries like NetworkX

Edge list

  • A plain list of (u, v) pairs — one per edge
  • Simplest possible format; easy to store as CSV
  • Great for loading data and streaming
  • Weights added as a third column (u, v, w)

Module I · Introduction to Social Media & Networks

CSIT406 · Social Media Analytics

43

44 of 68

WORKED EXAMPLE

WORKED EXAMPLE

Building a Small Friendship Graph

friends_graph.py

import networkx as nx

# 5 friends, undirected friendships

G = nx.Graph()

edges = [('Ana','Ben'), ('Ana','Cara'),

('Ben','Cara'), ('Cara','Dev'),

('Dev','Eli'), ('Ben','Eli')]

G.add_edges_from(edges)

print(G.number_of_nodes()) # |V| = 5

print(G.number_of_edges()) # |E| = 6

print(dict(G.degree()))

# {'Ana':2,'Ben':3,'Cara':3,'Dev':2,'Eli':2}

A graph in 8 lines

NetworkX turns an edge list into a full graph object with metrics ready to compute.

Degrees tell a story

Ben and Cara (degree 3) are the most connected — early hints of centrality.

Check the lemma

Degrees sum to 12 = 2 × 6 edges. The handshake lemma holds.

Module I · Introduction to Social Media & Networks

CSIT406 · Social Media Analytics

44

45 of 68

DEEPER DIVE

GRAPH THEORY

Where Graph Theory Began

THE BRIDGES OF KÖNIGSBERG (1736)

Euler asked whether one could walk the city crossing each of its seven bridges exactly once. By abstracting land to nodes and bridges to edges, he proved it impossible — founding graph theory.

Euler’s insight

Except at the start and end, each node needs an even number of edges to be traversable.

Why it failed

All of Königsberg’s nodes had odd degree, so no such walk exists.

Legacy

The idea of modelling relationships as a graph now underpins social-network analysis.

Module I · Introduction to Social Media & Networks

CSIT406 · Social Media Analytics

45

46 of 68

CORE SYLLABUS

GRAPH THEORY

Connectivity Vocabulary

Walk

Any sequence of nodes and edges; length = number of edges traversed.

Trail / Path

A trail repeats no edge; a path repeats no node or edge.

Cycle

A closed path that starts and ends at the same node.

Component

A maximal set of nodes all reachable from one another.

Module I · Introduction to Social Media & Networks

CSIT406 · Social Media Analytics

46

47 of 68

CORE SYLLABUS

GRAPH THEORY

Paths, Distance & Diameter

SHORTEST PATHS

The distance between two nodes is the length of the shortest path between them. The diameter of a graph is the longest such shortest path — how far apart the two most-separated nodes are.

Geodesic

The shortest path is also called the geodesic distance.

Small worlds

Huge social graphs have surprisingly small diameters — “six degrees”.

Average path length

The mean distance over all pairs summarises how tightly knit a network is.

Module I · Introduction to Social Media & Networks

CSIT406 · Social Media Analytics

47

48 of 68

CORE SYLLABUS

GRAPH THEORY

Connectivity & Components

Connected graph

A path exists between every pair of nodes — the network is one piece.

Components

Disconnected graphs split into components; social graphs usually have one giant component.

Strongly connected

In directed graphs, a strongly connected component has directed paths both ways.

Bridges (cut-edges)

An edge whose removal disconnects the graph — rare but critical connectors.

Articulation points

A node whose removal increases the number of components.

Robustness

How connectivity survives node/edge removal — key to resilience.

Module I · Introduction to Social Media & Networks

CSIT406 · Social Media Analytics

48

49 of 68

DEEPER DIVE

GRAPH THEORY

A Taxonomy of Special Graphs

Complete graph

Every pair of nodes is directly connected — maximum density.

Tree

A connected, acyclic graph; a forest is a set of disjoint trees.

Bipartite graph

Two disjoint node sets; edges only cross between them (users – groups).

Regular graph

Every node has exactly the same degree.

Ego network

A focal node (ego) plus its neighbours (alters) and their ties.

Planar graph

Can be drawn with no edges crossing.

Module I · Introduction to Social Media & Networks

CSIT406 · Social Media Analytics

49

50 of 68

CORE SYLLABUS

GRAPH THEORY

Graph Theory Applied to Social Networks

Finding influencers

Centrality measures rank the most important accounts.

Community detection

Dense subgraphs reveal groups and interest clusters.

Information flow

Paths and diffusion models trace how content spreads.

Link prediction

Structure suggests future or missing connections (recommendations).

Anomaly detection

Unusual structure flags bots, fraud and coordinated activity.

Visualisation

Layouts turn abstract graphs into interpretable maps.

Module I · Introduction to Social Media & Networks

CSIT406 · Social Media Analytics

50

51 of 68

DEEPER DIVE

NETWORK MODELS

Random Graphs (Erdős–Rényi)

THE G(n, p) MODEL

In an Erdős–Rényi random graph, each possible edge among n nodes exists independently with probability p. It is the baseline “null model” of a network with no special structure.

Degree distribution

Roughly binomial/Poisson — most nodes have similar degree.

What it misses

Real networks have hubs and clustering that random graphs lack.

Why it matters

It is the yardstick we compare real networks against.

Module I · Introduction to Social Media & Networks

CSIT406 · Social Media Analytics

51

52 of 68

DEEPER DIVE

NETWORK MODELS

Small-World Networks (Watts–Strogatz)

THE SMALL-WORLD PROPERTY

Small-world networks combine high local clustering (your friends know each other) with short average path lengths (few hops link anyone to anyone) — the famous “six degrees of separation”.

A few long ties

Rewiring a handful of edges into shortcuts collapses distances.

High clustering

Local neighbourhoods stay dense and cohesive.

Real & common

Social, neural and infrastructure networks are small-world.

Module I · Introduction to Social Media & Networks

CSIT406 · Social Media Analytics

52

53 of 68

DEEPER DIVE

NETWORK MODELS

Scale-Free Networks & the Power Law

Hubs dominate

A few nodes have enormous degree; most have very few — a heavy-tailed power law P(k) ~ k^−γ.

Preferential attachment

Barabási–Albert: new nodes attach to already-popular nodes — “rich get richer”.

Robust yet fragile

Resilient to random failure, but vulnerable to targeted attacks on hubs.

Illustrative degree distribution: node counts fall off sharply as degree grows — the signature of a scale-free network.

Module I · Introduction to Social Media & Networks

CSIT406 · Social Media Analytics

53

54 of 68

DEEPER DIVE

NETWORK MODELS

Comparing the Three Network Models

Property

Random (ER)

Small-world (WS)

Scale-free (BA)

Degree distribution

Poisson

Peaked

Power law

Clustering

Low

High

Varies

Average path length

Short

Short

Very short

Hubs?

No

No

Yes

Built by

Random edges

Rewiring

Preferential attachment

Real-world fit

Poor

Good (local)

Good (global)

These three models correspond directly to the network structures named in the course objectives.

Module I · Introduction to Social Media & Networks

CSIT406 · Social Media Analytics

54

55 of 68

CORE SYLLABUS

KEY METRICS

Degree Distribution of a Social Graph

What it shows

How node degrees spread across the network — the shape reveals its type.

Heavy tail

Most users have few ties; a small elite has very many — typical of real platforms.

Why we care

The tail is where the influencers live — the targets of many analytics tasks.

Module I · Introduction to Social Media & Networks

CSIT406 · Social Media Analytics

55

56 of 68

CORE SYLLABUS

KEY METRICS

The Metrics That Describe a Network

Three families of measures recur throughout the course: whole-network, node-level and neighbourhood.

Whole-network

Density, diameter, average path length — how the network looks overall.

Centrality (node-level)

Degree, closeness, betweenness, eigenvector — how important each node is.

Clustering

Local and global clustering coefficients — how tightly neighbours interconnect.

Module I · Introduction to Social Media & Networks

CSIT406 · Social Media Analytics

56

57 of 68

CORE SYLLABUS

KEY METRICS

Density

NETWORK DENSITY

Density is the fraction of possible edges that actually exist. For an undirected graph of n nodes: density = 2|E| / [n(n−1)]. It ranges from 0 (no ties) to 1 (complete graph).

Interpretation

High density = a tightly connected, cohesive group.

Scale effect

Large real networks are sparse — density falls as they grow.

Use

Compare cohesion across communities of similar size.

Module I · Introduction to Social Media & Networks

CSIT406 · Social Media Analytics

57

58 of 68

CORE SYLLABUS

KEY METRICS · CENTRALITY

Degree Centrality

DEGREE CENTRALITY

The simplest centrality: a node’s importance equals its number of connections, often normalised by dividing by (n−1). It answers “who is directly connected to the most people?”

What it captures

Local popularity and immediate reach.

Fast

Trivial to compute even on huge graphs.

Limit

Ignores position — a hub in a backwater still scores high.

Module I · Introduction to Social Media & Networks

CSIT406 · Social Media Analytics

58

59 of 68

CORE SYLLABUS

KEY METRICS · CENTRALITY

Closeness Centrality

CLOSENESS CENTRALITY

Closeness is the inverse of the average shortest-path distance from a node to all others. High closeness means a node can reach the whole network in few hops.

What it captures

Efficiency of spreading information from that node.

Interpretation

“How central am I to the flow of the whole network?”

Limit

Undefined across disconnected components without adjustment.

Module I · Introduction to Social Media & Networks

CSIT406 · Social Media Analytics

59

60 of 68

CORE SYLLABUS

KEY METRICS · CENTRALITY

Betweenness Centrality

BETWEENNESS CENTRALITY

Betweenness counts how often a node lies on the shortest paths between other pairs. High-betweenness nodes are brokers or bridges that control the flow of information.

What it captures

Gatekeeping and brokerage power between groups.

Interpretation

Remove a broker and communities may fall out of touch.

Cost

Expensive to compute exactly on very large graphs.

Module I · Introduction to Social Media & Networks

CSIT406 · Social Media Analytics

60

61 of 68

CORE SYLLABUS

KEY METRICS · CENTRALITY

Eigenvector Centrality & PageRank

INFLUENCE BY ASSOCIATION

Eigenvector centrality scores a node highly if it is connected to other high-scoring nodes. PageRank is a directed, random-walk variant famously used by Google to rank web pages.

Quality over quantity

Being linked by influential nodes matters more than raw count.

PageRank

Models a random surfer; robust to spammy, low-quality links.

Use

Identifying truly influential accounts, not just well-connected ones.

Module I · Introduction to Social Media & Networks

CSIT406 · Social Media Analytics

61

62 of 68

DEEPER DIVE

KEY METRICS · CENTRALITY

Which Centrality, and When?

Measure

Answers the question

Best used to find

Degree

Who has the most direct ties?

Locally popular accounts

Closeness

Who can reach everyone fastest?

Efficient broadcasters

Betweenness

Who bridges separate groups?

Brokers & gatekeepers

Eigenvector

Who is tied to important nodes?

Prestigious influencers

PageRank

Who is endorsed by well-linked nodes?

Authoritative accounts

No single measure is “best” — the right centrality depends on the analytical question you are asking.

Module I · Introduction to Social Media & Networks

CSIT406 · Social Media Analytics

62

63 of 68

CORE SYLLABUS

KEY METRICS

Clustering Coefficient

CLUSTERING COEFFICIENT

The local clustering coefficient of a node is the fraction of its neighbours that are also connected to each other — the probability that “friends of a friend are friends”. Averaged over all nodes it gives the global clustering.

What it captures

How tightly knit a node’s neighbourhood is (transitivity).

Small-world link

High clustering + short paths = a small-world network.

Communities

Regions of high clustering hint at communities to detect later.

Module I · Introduction to Social Media & Networks

CSIT406 · Social Media Analytics

63

64 of 68

WORKED EXAMPLE

WORKED EXAMPLE

Computing Metrics on Our Friendship Graph

metrics.py

import networkx as nx

# reuse G from the earlier example

print(nx.density(G)) # 0.60

print(nx.degree_centrality(G))

# Ben & Cara score highest (0.75)

print(nx.betweenness_centrality(G))

# Cara brokers between Dev/Eli and the rest

print(nx.clustering(G))

print(nx.average_clustering(G)) # ~0.53

Density 0.6

6 of 10 possible edges exist — a fairly cohesive little group.

Cara is central

High degree and betweenness make Cara the key connector.

Clustering ~0.53

Over half of each person’s friends know each other.

Module I · Introduction to Social Media & Networks

CSIT406 · Social Media Analytics

64

65 of 68

PRACTICAL

APPLICATION

Turning Metrics into Influencer Insight

Different business questions map to different metrics — this is analytics in action.

Maximise raw reach

Rank by degree / follower count to find accounts with the widest immediate audience.

Seed a fast campaign

Use closeness to pick accounts that reach the whole network in few hops.

Reach separate communities

Use betweenness to find brokers who connect otherwise-isolated audiences.

Find prestige influencers

Use eigenvector / PageRank to find accounts endorsed by other influential accounts.

Module I · Introduction to Social Media & Networks

CSIT406 · Social Media Analytics

65

66 of 68

DEEPER DIVE

STRUCTURAL CONCEPTS

Three More Ideas Worth Knowing

Reciprocity

In directed graphs, the share of ties that are mutual — a sign of genuine relationships versus one-way broadcasting.

Homophily

“Birds of a feather” — the tendency of similar people to connect, which shapes communities and diffusion.

Triadic closure

If A knows B and C, B and C are likely to connect — the engine behind friend recommendations.

Module I · Introduction to Social Media & Networks

CSIT406 · Social Media Analytics

66

67 of 68

DEEPER DIVE

READING METRICS WISELY

Interpreting Network Metrics — Do & Don’t

Good practice

  • Compare metrics against a null / random baseline
  • Choose the centrality that fits the question
  • Account for graph size when comparing density
  • Report the graph construction (what is a node/edge?)

Common mistakes

  • Treating high degree as automatic “importance”
  • Comparing densities of very different-sized graphs
  • Ignoring direction and weight when they matter
  • Over-trusting one metric in isolation

Module I · Introduction to Social Media & Networks

CSIT406 · Social Media Analytics

67

68 of 68

MODULE I SUMMARY

Foundations — Key Takeaways

Social media is participatory

Many-to-many, open and connected — and a vast source of data.

It reshapes society

Deep impact on communication, business and politics — for good and ill.

Networks are graphs

Actors are nodes; ties are edges; direction, weight and sign add nuance.

Structure has archetypes

Random, small-world and scale-free models describe real networks.

Metrics reveal importance

Density, centrality and clustering quantify structure and influence.

Graph theory is the toolkit

From Königsberg to PageRank, it powers social-network analysis.

68