Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
30 views28 pages

Unit 2 Notes Social Media

The document provides an overview of graphs and matrices in the context of social media analytics, detailing concepts such as nodes, edges, and various graph types. It discusses algorithms like BFS and DFS for analyzing social networks, as well as the importance of distance and connectivity in user interactions. Additionally, it covers network datasets, adjacency matrices, and the role of influencers in social media, emphasizing how these elements contribute to understanding social dynamics and user behavior.

Uploaded by

kanishk110871
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views28 pages

Unit 2 Notes Social Media

The document provides an overview of graphs and matrices in the context of social media analytics, detailing concepts such as nodes, edges, and various graph types. It discusses algorithms like BFS and DFS for analyzing social networks, as well as the importance of distance and connectivity in user interactions. Additionally, it covers network datasets, adjacency matrices, and the role of influencers in social media, emphasizing how these elements contribute to understanding social dynamics and user behavior.

Uploaded by

kanishk110871
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 28

ABES Engineering college

Social Media Analytics and Data Analysis BCAM061

Department of Computer
Science-AIML
Semester – VI

Submitted By Mr. Rohit Pratap Singh

(Assistant Professor Senior Scale)

Department of CSE-AIML
Unit -2
Graphs and Matrices

Graphs
Graph is a non-linear data structure consisting of vertices and edges.
The edges connect any two nodes in the graph, and the nodes are also
known as vertices.

Graph = G(V,E)
Node (also called vertex)
This is the fundamental unit of a graph, representing a single piece of data or
object within the system being modeled.

Edge (also called arc or link)


This line connects two nodes, indicating a relationship or interaction
between them.
Distance in Social Media Networks
The distance between two users measures their social proximity.
Closer distance → Higher likelihood of interaction.
Greater distance → Less probability of connection.
Distance Calculation Methods:
1. BFS (for unweighted graphs like friendships)
o Example: Shortest number of mutual friends between
two LinkedIn users.
2. Dijkstra’s Algorithm (for weighted graphs like message
frequency)
o Example: Finding the shortest communication chain in a
chat network.
3. Floyd-Warshall Algorithm (for all-pairs shortest path)
o Example: Measuring influence spread across different
Twitter users.
Breadth First Search (BFS)
Breadth-first search, by definition, visits all nodes at
distance d from the starting point before visiting any
nodes at distance d+1.

It begins with a node, then first traverses all its


adjacent nodes. Once all adjacent are visited, then
their adjacent are traversed.
Distance of each node of a Binary Tree from the
root node using BFS
The distance from the root to node 0 is 0.
The distance from the root to node 1 is 1.
The distance from the root to node 2 is 1.
The distance from the root to node 3 is 1.
The distance from the root to node 3 is 1.
The distance from the root to node 4 is 2.
The distance from the root to node 5 is 2.
The distance from the root to node 6 is 2.
The distance from the root to node 7 is 2.
Breadth-First Search (BFS) in Social Media
BFS is commonly used in social media analysis to explore connections
efficiently.
Applications of BFS:

Finding shortest paths between users (e.g., friend suggestions).


Detecting communities (identifying groups of interconnected users).
Hashtag propagation analysis (how a hashtag spreads over time).
Example:
• BFS can track how a meme goes viral on Twitter by exploring all user
interactions level by level.

Depth First Search (or DFS)


Depth First Search (or DFS)

Difference Between BFS and DFS


BFS DFS
Breadth First Search Depth First Search
uses Queue data uses Stack data
structure structure
Approach FIFO (First In Approach LIFO (Last In
First Out) First Out)
Vertex Based Algo. Edge Based Algo.
Not Suitable for Game or More Suitable for Game
Puzzle or Puzzle
BFS is slower and DFS is faster and
requires a large memory requires less memory.
space.
You don’t need to You need to follow a
backtrack in BFS. backtrack in DFS.
Time Complexity O(V + Time Complexity O(V
E), where V is the number + E), where V is the
of vertices and E is the number of vertices and E
number of edges is the number of edges
Network Datasets: An Overview
Network datasets are well suited to model transportation networks. They are
created from source features, which can include simple features (lines and points)
and turns, and store the connectivity of the source features. When you perform an
analysis using the ArcGIS Network Analyst extension, the analysis always
happens on a network dataset.

Network Datasets in Social Media Analytics


Network datasets store large-scale social interactions for research and
analysis.
Popular Social Media Datasets:
Facebook Social Circles – Friendship data for understanding
engagement.
Twitter Retweet Graphs – Studying content virality and fake
news detection.
YouTube Video Networks – Analyzing video recommendations
and user behavior.
Reddit Comment Graphs – Tracking discussion threads and
sentiment analysis.

Adjacency matrix
• also called the connection matrix
• Adjacency Matrix is a square matrix used to represent a finite graph
• An adjacency matrix is simple and easy to understand.
• Adding or removing edges from a graph is quick and easy.

The Adjacency Matrix in Social Media Networks


An adjacency matrix is a mathematical representation of connections in a
social network.
• Nodes (Vertices): Users, pages, hashtags, or posts.
• Edges (Links): Follows, likes, shares, mentions, or interactions.
Example: Twitter Follow Network
1.Adjacency Matrix for Undirected and
Unweighted graph:
[i][i] = 1, there is an edge between vertex i and vertex j.
A[i][i] = 0, there is NO edge between vertex i and vertex j.

2.Adjacency Matrix for Undirected and Weighted


graph
3 . Adjacency Matrix for Directed and Unweighted
graph and Adjacency Matrix for Directed and
Weighted graph

Paths in Social Networks


A path represents how users are connected through interactions.
• Shortest Path: Minimum steps between two users (e.g., "Six
Degrees of Separation").
• Viral Spread: How content moves from one user to another.
• Influencer Chains: Identifying key users who spread
information efficiently.
Example:
In a Facebook friendship network, a shortest path algorithm (like
BFS) finds the minimum number of connections between two users.
Connectivity in Social Media Graphs
Connectivity determines whether all users in a network are directly
or indirectly linked.
Types of Connectivity:
1. Strongly Connected (for directed graphs) – Every user can
reach every other user following connections.
2. Weakly Connected – Ignoring direction, all users are
connected.
3. Disconnected Graph – Some users are isolated from others.
Examples in Social Networks:
• Twitter retweet networks may be strongly connected, as
tweets circulate widely.
• Facebook groups can be weakly connected, where some
people are not directly friends but belong to the same group.
Unit -2
Graphs and Matrices
Types Of Graphs
1.Directed Graph
A graph in which edge has direction. That is the nodes are ordered pairs in the
definition of every edge.

2.Undirected Graph
A graph in which edges do not have any direction. That is the nodes are unordered
pairs in the definition of every edge.

3.Null Graph
several vertices but no edges connect them, a graph G= (V, E) is a null graph.
4.Infinite Graph
graph G=(V, E) is called a finite graph if the number of vertices and edges in the
graph is interminable.

5.Finite Graph
graph G=(V, E) is called a finite graph if the number of vertices and edges in the
graph is limited in number.
6.Complete Graph
If a graph G= (V, E) is also a simple graph, it is complete. Using the edges, with
n number of vertices must be connected. It's also known as a full graph because
each vertex's degree must be n-1.
7.Cyclic Graph
If a graph contains at least one graph cycle, it is considered to be cyclic.

8.Acyclic Graph
When there are no cycles in a graph, it is called an acyclic graph.
9.Directed Acyclic Graph
It's also known as a directed acyclic graph (DAG), and it's a graph with
directed edges but no cycle.

10.Weighted Graph
graph G= (V, E) is called a labeled or weighted graph because each edge has a
value or weight representing the cost of traversing that edge.
11.Subgraph
The vertices and edges of a graph that are subsets of another graph are known as
a subgraph.

12.Multi Graph
If there are numerous edges between a pair of vertices in a graph G= (V, E),
the graph is referred to as a multigraph. There are no self-loops in a
Multigraph.

13.Pseudo Graph
If a graph G= (V, E) contains a self-loop besides other edges, it is a pseudograph.
Random graphs
A random graph is a graph where the number of vertices, edges, and connections
between them are determined randomly.
Random graph theory is a combination of graph theory and probability theory.
A random graph is a graph in which properties such as the number of graph
vertices, graph edges, and connections between them are determined in some
random way
1. They Focus on Graphs Not Networks
2. Bi-Nomial Shape
3. Randomly distributed
4. Nodes Connected in Random
5. Network is Undirected.

The family of all labeled graphs with vertex set V = [n] = {1,2,...,n} and exactly
m edges.
Social networks evolve dynamically, and random graph models help
understand their growth.
Random Graph Models

Erdős–Rényi Model – Random connections between users (used for


modeling small-scale interactions).
Barabási–Albert Model (Scale-Free Networks) – Models influencer-
driven networks, where a few users have massive connections.

Example:
• Twitter’s Follower Network follows the scale-free property (a small
number of influencers have millions of followers).
• Facebook Friendships resemble small-world networks, where most
users are closely connected.

random graph with 8 vertices


8 distinct points (vertices) and connections (edges) between them are randomly
determined according to a set probability
Making connections
things relate to each other, or to draw on what you
already know to understand something
new.
the process of adding edges between vertices
(nodes) within a graph

Making Connections in Social Networks


Social media thrives on connections—whether through follows, likes, shares,
or mentions.
Connection Strength & Community Detection

Strong Ties – Close friends, frequent interactions.


Weak Ties – Casual connections, often bridges between communities
(important for network growth).
🛠 Algorithms for Detecting Connections:
Modularity-based Community Detection (Louvain Method) – Identifies
user groups.
Clique Percolation Method – Detects overlapping communities.
Graph Embeddings (Node2Vec, DeepWalk) – Finds hidden relationships.

Example:
LinkedIn’s “People You May Know” feature recommends connections based
on common friends (triadic closure) and similar interests (graph
embeddings).

hypergraph
hypergraph is a generalization of a graph in which an edge can join any number
of vertices.
hypergraph is defined as a tuple H = (V, E) where
• V is the set of hypervertices, and
• E is the set of hyperedges
• Hypergraphs in Social Media Analytics
• A hypergraph is an advanced form of a graph where edges (hyperedges)
connect multiple nodes at once.
• Examples of Hypergraphs in Social Media:
• Group Chats (WhatsApp, Messenger) – A single message sent to
multiple people forms a hyperedge.
Instagram Posts with Multiple Tags – A post tagging multiple users
creates a hyperedge.
Collaborative Content – Wikipedia articles with multiple
contributors.
• Applications:
• Analyzing group influence (e.g., which groups drive viral trends?).
Improving hashtag recommendations (users who use similar
hashtags are hyper-connected).
Understanding community formation (how groups emerge in
social networks).

K-Uniform hypergraph
If k=2
A hypergraph is 2-uniform if every edge in the hypergraph is a 2-edge, meaning it
connects exactly two vertices. A graph without self-loops is also a 2-uniform
hypergraph.
Nodes

a. The things that are connected are called Nodes, Vertices, Entities.
b. It can be people , Computer, countries etc.
c. Also represent contents: Web pages, Keyboard, videos etc.
d. It represent physical or virtual location or events .
e. Nodes are building block of network.

2. Nodes (Vertices) in Social Media Graphs


Nodes represent entities in a social network, such as:
Users (Facebook friends, Twitter followers)
Pages/Groups (LinkedIn companies, Reddit subreddits)
Posts & Hashtags (Instagram posts, trending Twitter topics)

Ties
a. The connection between nodes are called ties or Edge and links.
b. They are the relationship between nodes:
Friendship, trading, agreement, shared attributes, transactions etc.
c. It can be association/affiliation, formal relationship, biological
relationship etc

2. Ties (Edges) in Social Media Graphs


Ties represent relationships between nodes:
Friendships (Facebook, LinkedIn) – Undirected edges.
Followers (Twitter, Instagram) – Directed edges.
Likes, Comments, Shares – Weighted edges (based on interaction
frequency).
Link Analysis in Social Media
Link analysis helps in ranking users, detecting spam, and understanding
engagement patterns.

HITS Algorithm – Identifies hubs (content spreaders) and authorities


(trusted sources).
PageRank Algorithm – Ranks users and content based on influence.
Temporal Link Prediction – Predicts future connections based on past
interactions.
Example: YouTube Video Recommendations
• YouTube uses link analysis to recommend videos by tracking watch
history, likes, and comments.
• Related videos form clusters in the interaction graph.

Directed Edge (asymmetric edge)


- Have a clear origin and destination
- Twitter user follows another user,
- Email is sent to a recipient.

Undirected Edge(Symmetric edge)


- Two facebook users are friends
Influencer
• A person who has the power to influence many people as through social media
or traditional media.
• Influencers in social media are people who have built a reputation for their
knowledge and expertise on a specific topic. They make regular posts about that
topic on their preferred social media channels and generate large followings of
enthusiastic, engaged people who pay close attention to their views.

Influencers in social networks are the actors who have more ties than others, or
who have more central positions in the network. They are considered as key
players in spreading information, ideas, and influence across the network.

Influencers Types

• Mega Influencers – Have more than 1 million followers


• Macro Influencers – 40,000 to 1 million followers
• Micro Influencers – 1,000 to 40,000 followers
• Nano Influencers – Below 1,000 followers
Level of influence

• Celebrities
• Key Opinion Leader – Journalist, Industry Expert, Professionals
Influencers in Social Media
Influencers are key nodes with high impact in the network. They are identified
using centrality measures:
Degree Centrality – Users with the most connections (e.g., celebrities on
Instagram).
Betweenness Centrality – Users who act as bridges between different
groups (e.g., journalists on Twitter).
Eigenvector Centrality (PageRank) – Measures influence based on
connections to other influential users.

Weighted Networks in Social Media


Not all connections in social networks are equal—they have weights based on
interaction strength.
Types of Weights in Social Networks

Frequency-based Weights – Number of messages exchanged between two


users.
Engagement-based Weights – Likes, shares, retweets, comments.
Trust-based Weights – Verified users vs. anonymous accounts.
Example: Facebook Newsfeed Ranking
• Facebook assigns weights to interactions (likes < comments < shares)
to rank posts in newsfeeds.
• Posts from close friends (higher-weighted ties) appear more often
than random posts.

You might also like