Import network.csv into R and convert the data into an
adjacency matrix
library(igraph)
## Warning: package 'igraph' was built under R version 4.5.3
##
## Attaching package: 'igraph'
## The following objects are masked from 'package:stats':
##
## decompose, spectrum
## The following object is masked from 'package:base':
##
## union
# Import the dataset
network <- read.csv("C:/Users/rbron/Downloads/network.csv", row.names = 1, check.names = FALSE)
# Convert to a matrix
A <- as.matrix(network)
# View the adjacency matrix
A
## User1 User2 User3 User4 User5 User6
## User1 0 1 1 0 0 0
## User2 1 0 1 1 0 1
## User3 1 1 0 1 1 0
## User4 0 1 1 0 1 0
## User5 0 0 1 1 0 1
## User6 0 1 0 0 1 0
.
Create a labeled network visualization that displays:
All six users
The connections between users
A label for each user
A readable layout that makes the network structure easy to interpret
The visualization should clearly show which users are connected to one another.
# Create the network graph
g <- graph_from_adjacency_matrix(
A,
mode = "undirected",
diag = FALSE
)
# Plot the network
plot(
g,
vertex.label = V(g)$name,
vertex.size = 30,
vertex.color = "lightblue",
vertex.frame.color = "black",
vertex.label.color = "black",
vertex.label.cex = 1,
edge.color = "gray50",
main = "Social Media Network"
)
The dataset was imported into R and converted into an adjacency matrix. The matrix represents the connections between the six users. A network graph was created to display all users and their connections.
eigen_results <- eigen(A)
eigen_results$values
## [1] 3.1691946 0.7282124 0.2798483 -0.4662996 -1.5057879 -2.2051678
eigen_results$vectors
## [,1] [,2] [,3] [,4] [,5] [,6]
## [1,] -0.3128407 0.6076307 0.1486190 0.43625248 0.54837138 -0.1407144
## [2,] -0.4824825 0.2650812 0.3661540 -0.47990106 -0.14307832 0.5586567
## [3,] -0.5089707 0.1774030 -0.3245633 0.27647672 -0.68265268 -0.2483579
## [4,] -0.4339344 -0.1741920 -0.4406856 -0.54093404 0.40153969 -0.3651171
## [5,] -0.3837695 -0.5693330 -0.1649159 0.45566165 0.22109739 0.4948455
## [6,] -0.2733351 -0.4178063 0.7190975 0.05198249 -0.05181279 -0.4777425
dominant_index <- which.max(abs(eigen_results$values))
dominant_eigenvalue <- eigen_results$values[dominant_index]
dominant_eigenvalue
## [1] 3.169195
Use the eigenvector associated with the dominant eigenvalue.
The user corresponding to the largest absolute component of this eigenvector should be identified as the most influential user.
Important: Eigenvectors are unique only up to a scalar multiple. Therefore, your eigenvector may differ in sign from another student’s solution while still being mathematically correct. For example, if one solution produces positive values and another produces the same values with all signs reversed, both solutions represent the same eigenvector direction.
# Get the eigenvector associated with the dominant eigenvalue
dominant_eigenvector <- eigen_results$vectors[, dominant_index]
dominant_eigenvector
## [1] -0.3128407 -0.4824825 -0.5089707 -0.4339344 -0.3837695 -0.2733351
# Identify the user with the largest absolute eigenvector component
most_influential <- rownames(A)[which.max(abs(dominant_eigenvector))]
most_influential
## [1] "User3"
The eigenvalues were calculated, and the dominant eigenvalue is 3.1691946.
The eigenvector associated with the dominant eigenvalue was used to determine influence. User3 has the largest absolute eigenvector component (0.5089707), making User3 the most influential user in the network.
The eigenvector analysis provides useful information about which users may be most influential within the social network. User3 should be prioritized for the marketing campaign because User3 has the highest eigenvector centrality score, approximately 0.509. User2 should also be considered a priority because it has the same number of direct connections as User3 and has the second-highest eigenvector centrality score. User4 also has a relatively high centrality score and could be included as another important user.
Eigenvector centrality differs from simply counting the number of connections because it considers the importance of the users that each person is connected to. A user may have many connections, but those connections may not themselves be well connected. Eigenvector centrality gives more importance to users who are connected to other influential users. In this network, User2 and User3 both have four connections, but User3 has the higher eigenvector centrality score. This shows why connection count alone does not provide the complete picture.
Eigenvectors are useful for identifying influential users because they consider the structure of the entire network. Instead of looking at each user separately, the analysis identifies users who are connected to other important users. This can help a marketing company determine which users may have greater potential to spread information throughout the network.
However, network structure alone has limitations. Having influential connections does not necessarily mean that a user will be interested in the product, engage with the campaign, or influence purchasing decisions. The analysis also does not consider the quality of relationships or user behavior.
Additional information such as engagement rates, audience demographics, follower reach, past sharing behavior, product interests, and purchasing behavior would strengthen the marketing recommendation. Combining this information with eigenvector centrality would provide a more complete understanding of which users to target.
Social Network Influence Analysis
Topics
Eigenvalues
Eigenvectors
Network Representation
Eigenvector Centrality
Scenario
A marketing company wants to identify key influencers in a social media network before launching a new product campaign.
The company has information about connections among six users. The goal is to use eigenvalues and eigenvectors to identify which users may have the greatest influence within the network.
Dataset:
network.csvThe dataset represents an adjacency matrix. Each row and column represents a user.
Let Aij=1A_{ij}=1 if User ii and User jj are connected, and Aij=0A_{ij}=0 otherwise.
The network is undirected, so the adjacency matrix AA should be symmetric. The diagonal entries are zero because users are not connected to themselves.
The dominant eigenvalue is defined as the real eigenvalue with the largest magnitude. For this nonnegative adjacency matrix, it is also the largest eigenvalue.