Data Preparation

The two datasets used are “GAStech_email_node.csv” and “GAStech_email_edge-v2.csv”.
These datasets are first imported into the Rstudio environment.

setwd("C:/Users/Sean/Downloads/VA Project/Dataviz")
GAStech_nodes <- read_csv("data/GAStech_email_node.csv")
GAStech_edges <- read_csv("data/GAStech_email_edge-v2.csv")

Data Wrangling

As was done in Exercise 10, the data was reformatted. No changes in R codes were made here.

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()
  
GAStech_edges_aggregated

Creating Network Objects

As was done in Exercise 10, network objects were created using the Tidygraph library. No changes in R codes were made here.

GAStech_graph <- tbl_graph(nodes = GAStech_nodes, edges = GAStech_edges_aggregated, directed = TRUE)

GAStech_graph %>%
  activate(edges) %>%
  arrange(desc(Weight))

Task 1: Static Organisation Graph

This segment features the improved code chunk for the organisation network graph

# Data Wrangling: Calculating betweenness and closeness of node and edges
GAStech_graph <- mutate(GAStech_graph, betweenness_centrality = centrality_betweenness()) 
GAStech_graph <- mutate(GAStech_graph, closeness_centrality = centrality_closeness())

layout <- create_layout(GAStech_graph, layout='nicely')

g <- ggraph(layout) +
  geom_edge_link(aes()) + 
  geom_node_point(aes(colour=closeness_centrality, size=betweenness_centrality)) +
  theme_graph()
The following are areas where the organisation network graph can be improved:
  1. The edges of the graph are too dark. This makes it difficult to differentiate between the edges and nodes, especially for nodes with low closeness_centrality values.

  2. It is difficult to make out distinct nodes due to overlapping of nodes. Overlapping nodes with similar closeness_centrality values will appear to merge together.

  3. There are no labels given for each corresponding node, and it is difficult to make meaningful relationships between nodes with the amount of information given.


Sketch of plot for Q1

Alternative design for Static Organisation Graph
GAStech_graph <- mutate(GAStech_graph, betweenness_centrality = centrality_betweenness()) 
GAStech_graph <- mutate(GAStech_graph, closeness_centrality = centrality_closeness())

layout <- create_layout(GAStech_graph, layout='nicely')

g <- ggraph(layout) +
  geom_edge_link(aes(alpha=Weight), color="grey50") + 
  geom_node_point(aes(fill=Department, size=betweenness_centrality, alpha=closeness_centrality),pch=21, color="black") + 
  scale_fill_brewer(palette="Dark2")+
  scale_size_continuous(range = c(3, 12))+
  geom_text(aes(x= g[["data"]][["x"]], y=g[["data"]][["y"]],label=g[["data"]][["label"]]),size=2) + 
  labs(size="Centrality Between", alpha="Centrality Closeness") + 
  theme_graph()
  
g

Task 2: Interactive Organisation Graph

v <- visNetwork(GAStech_nodes, GAStech_edges_aggregated, main= "Interactive Organisation Graph") %>%
  visIgraphLayout(layout = "layout_with_fr") %>%  
  visEdges(color = list(highlight = "blue", hover = "blue")) %>%
  visOptions(highlightNearest = list(enabled=TRUE, labelOnly=FALSE, degree=1), nodesIdSelection=TRUE) 

v
The following are three aspects in which the graph visualisation can be improved upon
  1. The size of labels in the visualisation are very small and requires users to zoom in to view the labels.

  2. Though nodes are coloured by groups, there is no way to tell which colour belongs to which group.

  3. Given that the organisation graph should be interactive, more interactive elements should be put in place.

    Sketch of plot for Q2

Alternative design for Interactive Organisation Graph
nodes <- GAStech_nodes %>% mutate(font.size=40)

v <- visNetwork(nodes, GAStech_edges_aggregated, main= "Interactive Organisation Graph") %>%
  visIgraphLayout(layout = "layout_with_fr") %>%  
  visEdges(color = list(highlight = "blue", hover = "blue")) %>%
  visOptions(highlightNearest = list(enabled=TRUE, labelOnly=FALSE, degree=1), nodesIdSelection=TRUE, selectedBy="group") %>% 
  visGroups(groupname = "Administration", color="#1B9E77") %>%
  visGroups(groupname = "Engineering", color="#D95F02") %>%
  visGroups(groupname = "Executive", color="#7570B3") %>%
  visGroups(groupname = "Facilities", color="#E7298A") %>% 
  visGroups(groupname = "Information Technology", color = "#66A61E") %>%
  visGroups(groupname = "Security", color="#E6AB02") %>%
  visLegend() %>% 
  visInteraction(hover=TRUE, hideEdgesOnDrag=TRUE, tooltipDelay=0) 

v