Data Preparation

library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(igraph)
## 
## Attaching package: 'igraph'
## The following objects are masked from 'package:dplyr':
## 
##     as_data_frame, groups, union
## The following objects are masked from 'package:stats':
## 
##     decompose, spectrum
## The following object is masked from 'package:base':
## 
##     union
setwd("/Users/ajarakudaibergenova/Documents/UNH/USML/")

# Load data from CSV file
network <- read.csv("networkdata.csv")

summary <- network %>%
  group_by(from, to) %>%
  summarize(emails = sum(texts))
## `summarise()` has grouped output by 'from'. You can override using the
## `.groups` argument.
summary

Network Analysis

email <- graph_from_data_frame(summary, directed = TRUE)


vertex_color <- "pink"
arrow_color <- "darkblue"


plot(email, 
     edge.label = E(email)$emails,
     edge.label.cex = 0.8,
     edge.arrow.size = 0.01 * E(email)$emails,
     vertex.label = V(email)$name,
     vertex.color = vertex_color,
     vertex.label = V(email)$name,
     main = "Email Network",
     layout = layout_nicely)

Metrics

degree <- degree(email, mode = "out")
closeness <- closeness(email, mode = "out")
density <- graph.density(email)

degree
##     Joe    Jose     Kim    Lynn    Mike Patrick    Rose   Steve 
##       3       1       5       2       6       7       4       0
closeness
##       Joe      Jose       Kim      Lynn      Mike   Patrick      Rose     Steve 
## 0.3333333 1.0000000 0.2000000 0.5000000 0.1666667 0.1428571 0.2500000       NaN
density 
## [1] 0.5

Connectivity

connection <- is.connected(email)
connection
## [1] TRUE

Results

The network is connected, there is a connectivity between every pair of vertices. This suggests that there is a continuous flow of emails throughout the network.