0% found this document useful (0 votes)
7 views

SNA Assignment 11

Uploaded by

pedrig912
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

SNA Assignment 11

Uploaded by

pedrig912
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Social Network Analysis

Assignment 1
Date of Submission: 06/01/2025

by

Ayush Tripathy
UCSE22011

Submitted To

Dr.Rudra Mohan Tripathy


Dean, School of CSE

School of Computer Science &


Engineering
XIM University
1 Methodology
In this section, we describe the methodologies used to compute various cen-
trality measures, clustering coefficients, and solve the maximum flow prob-
lem. Additionally, we include the steps to calculate each metric.

1.1 Centrality Measures


a. Degree Centrality
Degree centrality of a node is the number of edges connected to it.

CD (v) = deg(v)

Steps to Calculate:
1. For each node in the graph, count the number of direct neighbors.

2. Assign this count as the degree centrality of the node.


b. Closeness Centrality
Closeness centrality measures how close a node is to all other nodes in the
graph.
1
CC (v) = P
u̸=v d(u, v)

Steps to Calculate:
1. Compute the shortest path from the node to all other nodes using a
pathfinding algorithm (e.g., Dijkstra).

2. Sum the shortest path distances.

3. Take the reciprocal of the sum.


c. Betweenness Centrality
Betweenness centrality measures the frequency of a node appearing on short-
est paths between other nodes.
X σst (v)
CB (v) = ,
s̸=v̸=t
σst

Steps to Calculate:

1
1. For each pair of nodes, calculate all shortest paths.

2. Count how many times the node appears on these paths.

3. Normalize the centrality by dividing by the total number of pairs.

d. Eigenvector Centrality
Eigenvector centrality assigns relative scores to all nodes based on the prin-
ciple that connections to high-scoring nodes contribute more.

Ax = λx

Steps to Calculate:

1. Represent the graph as an adjacency matrix A.

2. Solve for the eigenvector corresponding to the largest eigenvalue λ.

3. Normalize the eigenvector.

e. PageRank Centrality
PageRank centrality evaluates the importance of nodes using the following
formula:
Cp = β(I − αA⊤ D)−1 · 1
Steps to Calculate:

1. Set initial scores for all nodes.

2. Iteratively update scores based on the contributions of neighboring


nodes.

3. Repeat until convergence.

1.2 Clustering Coefficients


f. Global Clustering Coefficient
The global clustering coefficient measures the overall level of clustering in
the graph.
3 × Number of Triangles
CG =
Number of Connected Triplets
Steps to Calculate:

2
1. Count all triangles in the graph.

2. Count all connected triplets.

3. Use the formula above to compute CG .

g. Local Clustering Coefficient


The local clustering coefficient measures the tendency of a node’s neighbors
to form a clique.
Number of pairs of neighbors of vi that are connected
C(vi ) =
Number of pairs of neighbors of vi
Steps to Calculate:

1. For each node, identify all its neighbors.

2. Count the edges between these neighbors.

3. Divide by the total possible pairs of neighbors.

2 Results
2.1 Comparison of Centrality Measures
The centrality measures were computed for two graphs:

• A graph with 1000 nodes and a connection probability of 0.01.

• A smaller graph for better visualization and analysis.

Figures 1 and 2 depict the results.

2.2 Maximum Flow Problem


We solve the maximum flow problem using the Ford-Fulkerson algorithm.
The steps and pseudocode for the algorithm are provided below:
Pseudocode:

3
Figure 1: Centrality measures for the graph with 1000 nodes.

Figure 2: Centrality measures for the smaller graph.

FORD-FULKERSON(G, s, t)
for each edge (u, v) E[G]
do f[u, v] ← 0
f[v, u] ← 0
while there exists a path p from s to t in the residual network G_f
do c_f(p) ← min{c_f(u, v): (u, v) is in p}
for each edge (u, v) in p
do f[u, v] ← f[u, v] + c_f(p)
Steps to Calculate:
1. Initialize all edge flows to zero.

4
2. Find an augmenting path in the residual network.

3. Update the flow along the path by the bottleneck capacity.

4. Repeat until no more augmenting paths exist.

5. The maximum flow is the sum of flows leaving the source.

Figures 3 and 4 show the graph and the resulting flow network.

Figure 3: Graph for the maximum flow problem.

The maximum value of the flow is 23.

5
Figure 4: Flow network after applying Ford-Fulkerson.

You might also like