0% found this document useful (0 votes)
102 views34 pages

Social Network Analytics Session2

This document contains a presentation on social network analytics. It discusses creating directed and undirected networks in Jupyter notebooks. It defines degree, indegree, and outdegree for nodes in directed and undirected graphs. Examples are provided to calculate these measures for different networks. Code is provided to create networks in Jupyter and find the degree, indegree, outdegree, predecessors, and successors for nodes in directed graphs.

Uploaded by

Aman Saxena
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)
102 views34 pages

Social Network Analytics Session2

This document contains a presentation on social network analytics. It discusses creating directed and undirected networks in Jupyter notebooks. It defines degree, indegree, and outdegree for nodes in directed and undirected graphs. Examples are provided to calculate these measures for different networks. Code is provided to create networks in Jupyter and find the degree, indegree, outdegree, predecessors, and successors for nodes in directed graphs.

Uploaded by

Aman Saxena
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/ 34

Social Network Analytics – Session 1

Social Network Analytics – Session 2

29-09-2021 Presented by Dr. Purva Grover 1


Social Network Analytics – Session 1

Create below directed network in Jupyter– Network3

4
2

1
3

29-09-2021 Presented by Dr. Purva Grover 2


Social Network Analytics – Session 1

Create Network3 in Jupyter and find In & Out Degree for all nodes

29-09-2021 Source Code: Network3.ipynb 3


Social Network Analytics – Session 1

Examples of Directed & Undirected Network


Undirected Network Directed Network
Internet Email messages
Train Routes Citation Networks
Peer- to – Peer Networks

29-09-2021 Presented by Dr. Purva Grover 4


Social Network Analytics – Session 1

Problem Statement 2
Q1. The network drawn in Problem Statement 1 is directed or
undirected network ?
Q2. Create the network drawn in “Problem Statement 2” in Jupyter.

29-09-2021 Presented by Dr. Purva Grover 5


Social Network Analytics – Session 1

Network Measures: Classification

Microscopic

Mesoscopic

Macroscopic

29-09-2021 Presented by Dr. Purva Grover 6


Social Network Analytics – Session 1

Network Measures: Classification


Microscopic
• Degree
• Local clustering coefficient
• Node centrality

Mesoscopic
• Connected components
• Giant components
• Group centralities

Macroscopic
• Degree Distribution
• Path and Diameter
• Edge density
• Global clustering coefficient
• Reciprocity and Assortativity

29-09-2021 Presented by Dr. Purva Grover 7


Social Network Analytics – Session 1

Degree for Undirected Graph


❑ For an undirected, unweighted network, degree of a node v is
defined as the number of nodes in the network to which
there is an edge from the node v.
(or)
❑ For an undirected, unweighted network, degree of a node v is
the number of edges of the network that are incident on the
node v. (Degree of a node is the number of edges that
connect to the node).
Note: A self-loop is counted twice in evaluating degree of a node.
29-09-2021 Presented by Dr. Purva Grover 8
Social Network Analytics – Session 1

Degree for Undirected Graph


6
1 5
Node Degree Neighbour

4 1 2 2,5
2 3 1,3,5
2 3 2 2,4
3
4 3 3,5,6
5 3 1,2,4
6 1 4

29-09-2021 Presented by Dr. Purva Grover 9


Social Network Analytics – Session 1

Compute degree for all the nodes in Undirected Graph – Network2

A
B G

C
F

E
D
H
I
J
29-09-2021 Presented by Dr. Purva Grover 10
Social Network Analytics – Session 1

Compute degree for all the nodes in Undirected Graph – Network2


Node Degree Neighbour

A 1 B
A
B 2 A, C
B G C 3 B, E, F
D 1 E
C
E 5 C, D, I, J, H
F
F 2 C, G
E G 1 F
D H 1 E
H I 2 E, J
I J 2 I, E
J
29-09-2021 Presented by Dr. Purva Grover 11
Social Network Analytics – Session 1

Create Network1 in Jupyter and find the Degree for all nodes

29-09-2021 Source Code: Network1.ipynb 12


Social Network Analytics – Session 1

Code for finding the Neighbors in Undirected Graph


5

1 4

2
6
3

29-09-2021 Presented by Dr. Purva Grover 13


Social Network Analytics – Session 1
Create network in Jupyter and find the Degree & Neighbors for all nodes – Network2

A
B G

C
F

E
D
H
I
J
29-09-2021 Presented by Dr. Purva Grover 14
Social Network Analytics – Session 1

Degree – Directed Graph


❑ Degree of a node is the number of edges that connect to the
node
❑ Indegree: Number of incoming edges to the node
❑ Outdegree: Number of out going edges to the node

29-09-2021 Presented by Dr. Purva Grover 15


Social Network Analytics – Session 1

Indegree and Outdegree for directed graph – Network3

4
2

1
3

29-09-2021 Presented by Dr. Purva Grover 16


Social Network Analytics – Session 1

Indegree and Outdegree for directed graph – Network3


Node Indegree Outdegree
5
1 0 1
2 1 3
4 3 2 0
2
4 2 1
1 5 1 1
3

29-09-2021 Presented by Dr. Purva Grover 17


Social Network Analytics – Session 1

Compute degree for all the nodes in Directed Graph – Network4

F
H
D

G E
B

C
29-09-2021 Presented by Dr. Purva Grover 18
Social Network Analytics – Session 1

Compute degree for all the nodes in Directed Graph


Node Indegree Outdegree
A 0 3
B 1 1 F
C 2 0
D 2 1 H
E 0 3 D
F 2 0
G 1 0
H 1 1

E B

A
G
C
29-09-2021 Presented by Dr. Purva Grover 19
Social Network Analytics – Session 1

Create Network3 in Jupyter and find In & Out Degree for all nodes

29-09-2021 Source Code: Network3.ipynb 20


Social Network Analytics – Session 1

Predecessors and Successors for directed graph – Network3


Node Predecessors Successors
5
1 - 2
2 1 3,4,5
4 3 2,4 -
2
4 2,5 3
1 5 2 4
3

29-09-2021 Presented by Dr. Purva Grover 21


Social Network Analytics – Session 1

Finding Predecessors and Successors in Code

29-09-2021 Presented by Dr. Purva Grover 22


Social Network Analytics – Session 1

Create Network4 in Jupyter and find In & Out Degree for all nodes

F
H
D

G E
B

C
29-09-2021 Presented by Dr. Purva Grover 23
Social Network Analytics – Session 1

Importance of Degree in Network


❑More connection, more influence & more access to
information

29-09-2021 Presented by Dr. Purva Grover 24


Social Network Analytics – Session 1

Problem Statement – 1A
ABC Company, Transportation and logistics services across the world using flight services
only for sending their shipments. Everyday manager at “ABC Company” download the
CSV containing the flight information from source to destination from 3rd party vendor.
On the basis of the dataset provided and using network analytics answer the following
questions:
Q1. Draw the network.
Q2. Which airport is having most of the traffic?
Q3. Which airport is having the minimum traffic?
Q4. As a manager, please suggest the airports at which you would like to buy warehouse
space for keeping your shipments? Assume if your organization is not buying the space
then you have to take the space on the rent, approx. Buying Warehouse = 15*Rent

[Hint: Read data using pandas and create network using from_pandas_edgelist function]

29-09-2021 Presented by Dr. Purva Grover 25


Social Network Analytics – Session 1

Q1. Draw the network.

29-09-2021 Presented by Dr. Purva Grover 26


Social Network Analytics – Session 1

29-09-2021 Presented by Dr. Purva Grover 27


Social Network Analytics – Session 1
Q2 & Q3. Which airport is having most of the traffic? Which airport is having the minimum traffic?

29-09-2021 Presented by Dr. Purva Grover 28


Social Network Analytics – Session 1

Problem Statement – 1B
ABC Company, Transportation and logistics services across the world using flight services
only for sending their shipments. Everyday manager at “ABC Company” download the
CSV containing the flight information from source to destination from 3rd party vendor.
On the basis of the dataset provided and using network analytics answer the following
questions:

Q5. List all nodes which can be visited in single step from node 'EWR'.
Q6. List all nodes which can be visited in single step from node 'IAD'.
Q7. List all places from where we can get the flight for 'DCA'.
Q8. List all places from where we can get the flight for 'JFK’
Q9. The company can buy only one warehouse. According to you where should company
buy the warehouse ?

29-09-2021 Presented by Dr. Purva Grover 29


Social Network Analytics – Session 1

29-09-2021 Presented by Dr. Purva Grover 30


Social Network Analytics – Session 1

Problem Statement - 2
Assume you are manager at “Uber Eats”. Uber Eats is an online food ordering and
delivery platform launched by Uber in 2014. Users can read menus, reviews and ratings,
order, and pay for food from participating restaurants using an application on the iOS or
Android platforms, or through a web browser. Users are also able to tip for delivery.
3rd party vendor provides you the CSV which is containing the connections among your
potential customers. On the basis of the dataset provided and using network analytics
answer the following questions:
Q1. Draw the network.
Q2. To increase your sales, there is a need to increase the reputation of “Uber Eats”
among potential customer. Therefore, according to you who will be your target customer
to whom you will give the following coupons:
a. 100% of on first bill
b. 70% of on first bill
c. 40% of on first bill
29-09-2021 Presented by Dr. Purva Grover 31
Social Network Analytics – Session 1

29-09-2021 Presented by Dr. Purva Grover 32


Social Network Analytics – Session 1
References
❑Chakraborty, T. (2021). Social Network Analysis. Wiley India Pvt. Ltd.
❑https://www.analyticsvidhya.com/blog/2018/04/introduction-to-
graph-theory-network-analysis-python-codes/
❑Newman, M. (2010). Networks: an introduction. Oxford University
Press.

29-09-2021 Presented by Dr. Purva Grover 33


Social Network Analytics – Session 1

You might also like