For my personal network graph, I included five people in my network: my father, mother, brother, and two friends. I am connected to everyone in the network. My family members also know each other, and my two friends know each other.
library(igraph)
##
## Attaching package: 'igraph'
## The following objects are masked from 'package:stats':
##
## decompose, spectrum
## The following object is masked from 'package:base':
##
## union
g5 <- graph_from_literal(
Elisa-Father:Mother:Brother:Friend1:Friend2,
Father-Mother,
Father-Brother,
Mother-Brother,
Friend1-Friend2
)
set.seed(123)
plot(
g5,
vertex.color = "lightblue",
vertex.label.color = "black",
vertex.size = 30,
edge.width = 2
)
A fitness-apparel brand is launching a new product and can give free samples to only two people. The network below shows who influences whom on social media. I will use network metrics to decide who should receive the samples.
library(igraph)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:igraph':
##
## as_data_frame, groups, union
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
# A social media network around a brand
g_mkt <- graph_from_literal(
Brand-Ava-Ben-Cara,
Brand-Cara,
Ava-Dan:Eli:Fay,
Ben-Gus,
Cara-Hal:Ivy,
Dan-Eli,
Fay-Gus,
Hal-Ivy-Jon,
Brand-Kim-Jon
)
set.seed(123)
plot(
g_mkt,
vertex.color = "lightblue",
vertex.label.color = "black"
)
Looking at the network visually, Ava and Cara appear to be some of the most central people because they have several connections to other people in the network. There are also tightly connected groups, including Ava, Dan, and Eli and Cara, Hal, and Ivy. Hal, Ivy, and Jon also appear to form a closely connected group.
centrality_df <- data.frame(
person = V(g_mkt)$name,
degree = degree(g_mkt),
closeness = round(closeness(g_mkt), 3),
betweenness = round(betweenness(g_mkt), 2)
)
centrality_df %>% arrange(desc(betweenness))
## person degree closeness betweenness
## Ava Ava 5 0.050 25.83
## Cara Cara 4 0.048 18.17
## Brand Brand 3 0.050 17.00
## Ben Ben 3 0.048 13.33
## Kim Kim 2 0.037 5.00
## Ivy Ivy 3 0.037 4.50
## Fay Fay 2 0.036 2.17
## Gus Gus 2 0.034 1.50
## Jon Jon 2 0.033 1.50
## Dan Dan 2 0.034 0.00
## Eli Eli 2 0.034 0.00
## Hal Hal 2 0.034 0.00
Your answer: Which people rank highest on each measure? Do the rankings agree?
I will answer this section based on the results from the R code above.
Which two people should receive free samples? Justify your choice using at least two different metrics.
I will choose the two customers based on the centrality results from Task 2.