1.0 Task 1 Preparation
packages = c('igraph', 'tidygraph', 'ggraph', 'visNetwork', 'lubridate', 'tidyverse', 'extrafont')
for(p in packages){library
if(!require(p, character.only = T)){
install.packages(p)
}
library(p, character.only = T)
}
1.2 Data Wrangling
GAStech_nodes <- read_csv("data/GAStech_email_node.csv")
GAStech_edges <- read_csv("data/GAStech_email_edge-v2.csv")
GAStech_edges$SentDate = dmy(GAStech_edges$SentDate)
GAStech_edges$Weekday = wday(GAStech_edges$SentDate, label = TRUE, abbr = FALSE)
GAStech_edges_aggregated <- GAStech_edges %>%
filter(MainSubject == "Work related") %>%
group_by(source, target, Weekday) %>%
summarise(Weight = n()) %>%
filter(source!=target) %>%
filter(Weight > 1) %>%
ungroup()
2.0 Task 1: Static Organisation Graph
2.1 Original Code
GAStech_graph <- tbl_graph(nodes = GAStech_nodes, edges = GAStech_edges_aggregated, directed = TRUE)
g <- GAStech_graph %>%
mutate(betweenness_centrality = centrality_betweenness()) %>%
mutate(closeness_centrality = centrality_closeness()) %>%
ggraph(layout = "nicely") +
geom_edge_link(aes()) +
geom_node_point(aes(colour = closeness_centrality, size=betweenness_centrality))
g

2.2 ISSUES
1. The colour used for the level of closeness centrality is close to the colour used for betweenness centrality. Both are black or close to black and thus, it is hard to see. Also, not contrasting enough for the closeness centrality colour scale.
2. There are no node labels to identify. Since it is a static graph and not a n interactive graph, it is less informative without labels
3. Display departments tto let users know which department each employee belongs to
2.3 sketch of your alternative design
knitr::include_graphics("1.png")

2.4 Revised Code
g <- GAStech_graph %>%
mutate(betweenness_centrality = centrality_betweenness()) %>%
mutate(closeness_centrality = centrality_closeness()) %>%
ggraph(layout = "kk") +
geom_edge_link(colour="darkgrey")+
#geom_node_point(aes(colour= closeness_centrality))+
geom_node_circle(aes(fill = closeness_centrality, r = log(betweenness_centrality)/100, col = Department), size=1.8)+
geom_node_text(aes(label=label), repel = TRUE)+
scale_fill_gradient(low="#FF0000",high="#00FF00")
g

3.0 Task 2 - Interactive Organisation Graph
3.1 Data Preparation
GAStech_edges_aggregated <- GAStech_edges %>%
left_join(GAStech_nodes, by = c("sourceLabel" = "label")) %>%
rename(from = id) %>%
left_join(GAStech_nodes, by = c("targetLabel" = "label")) %>%
rename(to = id) %>%
filter(MainSubject == "Work related") %>%
group_by(from, to) %>%
summarise(weight = n()) %>%
filter(from!=to) %>%
filter(weight > 1) %>%
ungroup()
GAStech_nodes <- GAStech_nodes %>%
rename(group = Department)
3.2 Original Code
visNetwork(GAStech_nodes, GAStech_edges_aggregated) %>%
visIgraphLayout(layout = "layout_with_fr") %>%
visOptions(highlightNearest = TRUE, nodesIdSelection = TRUE)
3.3 ISSUES
1. There is no label of the respective departments
2. The names/labels are not viewable from one glance, it can only be seen when zoomed in. There is a need to improve so that users can view from one glance without zooming in
3. Upon clicking on a node, even tho points that are not linked, the lines are still highlighted if the degree of link is more than 1.
3.4 sketch of your alternative design
knitr::include_graphics("2.png")

3.5 Revised Code
visNetwork(GAStech_nodes, GAStech_edges_aggregated, height = "700px", width = "100%") %>%
visIgraphLayout(layout = "layout_with_fr") %>%
visNodes(font = list(size = 30), shape = "box", title = "Title") %>%
visOptions(selectedBy = "group", highlightNearest = list(enabled = TRUE, algorithm='hierarchical'), nodesIdSelection = TRUE) %>%
visLegend(position = "right", main = "Department")