Library Installation
Packages are installed to plot necessary charts.
Import the network datas
Task 1: Static Organisation Graph
Filter the dataset
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()Create network objects
1.1 Improve the code chunk used to create the organisation network graph by using the latest functions provided in ggraph2.0
Original code
1.2 Identify three aspects of the graph visualisation in Section 6.1 that can be improved.
Lack of labelling
- Difficult for users to interpret information
- No categorisation by Weekday or Department.
The edges are difficult to identify
- Thick edges and the black edges confuse users with the darker shades nodes.
Nodes
- The size of nodes is not scaled
- Lower closeness centrality leads to darker shades.
Colour
- The colour of edges and nodes are not clear and hard to read
1.3 Provide the sketch of your alternative design.
1.4 Using appropriate ggraph functions, plot the alternative design.
Improvements made: * Scaling are added for edges and nodes. The reduced thickness of edges and larger nodes improve readibility. *
GAStech_graph<- GAStech_graph %>%
mutate(betweenness_centrality = centrality_betweenness()) %>%
mutate(closeness_centrality = centrality_closeness())
g <- ggraph(GAStech_graph, layout="nicely") +
geom_edge_link0(aes(edge_width=Weight), color="grey", alpha=0.5) +
geom_node_point(aes(colour = closeness_centrality, size=betweenness_centrality)) +
#Scale line
scale_edge_width_continuous(range = c(0.4,0.9))+
#Scale nodes
scale_size_continuous(range=c(2,8)) +
geom_node_text(aes(label =label), colour = "#53584C",size = 2) +
scale_color_gradient(low = "#F0F4C3", high = "#E14275")+
geom_node_label(aes(filter=closeness_centrality > 0.015, label= label), repel = TRUE)+
ggtitle("Alternative Design")
g + theme_graph() + theme(legend.position = "right")Network graph by Department and Weekday
The overall network graph provides relevant informartion about the key employees in organisation’s network and interactions with other employees. In this graph, categorisation by Department and Weekday convey 2 vital messages: Key employees for each department Show interaction based on weekday. The thicker edges indicate more interactions take place.
g <- ggraph(GAStech_graph, layout="nicely") +
geom_edge_link0(aes(edge_width=Weight), c="grey66", alpha=0.5) +
geom_node_point(aes(colour = closeness_centrality, size=betweenness_centrality)) +
#Scale line
scale_edge_width_continuous(range = c(0.5,0.9))+
#Scale nodes
scale_size_continuous(range=c(2,8)) +
scale_color_gradient(low = "#F0F4C3", high = "#E14275")+
geom_label_repel(aes(x=ifelse(closeness_centrality > 0.015, x, 0),
y=ifelse(closeness_centrality > 0.015, y, 0),
label=ifelse(closeness_centrality > 0.015, label,"")),
color = 'black',
size = 2,
box.padding = 0.50, point.padding = 0.5,
na.rm=TRUE) +
ggtitle("Centrality indices Chart by Department and Weekday")
g + facet_graph(Weekday~Department) + theme_graph()Task 2: Interactive Organisation Graph
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()Rename Department column to group
2.1 Improve the design of the graph by incorporating the following interactivity:
When a name is selected from the drop-down list, the corresponding node will not only be highlighted but also will be labelled. Furthermore, all the linked nodes of the selected node will also be labelled too.
When a node of the interactive graph is selected, the node will not only be highlighted but also will be labelled. Furthermore, all the linked nodes of the selected node will be labelled as well.
2.2 Identify three aspects of the graph visualisation in Section 7.4 that can be improved.
- Clear label.
- The size of label helps to aid in conveying important information and further improve readability
- Colour
- Node colors are not defined. The color is not defined in the legend, thus it is difficult to derive any meaningful information
- Tooltips
- Details of name, department and job title are presented to display a particular employee’s information
2.3 Provide the sketch of your alternative design.
2.4 Using appropriate visNetwork functions, plot the alternative design.
visNetwork(GAStech_nodes, GAStech_edges_aggregated) %>%
visIgraphLayout(layout = "layout_with_fr") %>%
visOptions(highlightNearest = list(enabled = TRUE, degree = 1, hover = TRUE),
selectedBy = list(variable= "group", main="Department"),
nodesIdSelection = list(main="Employee Name")) %>%
visNodes(labelHighlightBold = TRUE, shape = "box", font = list(size=30)) %>%
visLegend(position="right", zoom=FALSE) %>%
visEdges(arrows = "to", color = list(highlight="#424242"))