This commit is contained in:
Noah L. Schrick 2023-04-15 07:53:14 -05:00
parent cf3cef21b6
commit 7e2ea0008b

View File

@ -51,7 +51,8 @@ base_centralities[[2,1]] <- hipaa.deg %>% sort(decreasing = T)
base_centralities[[3,1]] <- pci.deg %>% sort(decreasing = T)
car_deg_Fn <- ( ecdf( car.deg ))
car_plots[[1,1]] <- car_deg_Fn(car.deg)*100
#car_plots[[1,1]] <- car_deg_Fn(car.deg)*100
car_plots[[1,1]] <- car.deg/max(car.deg)
#### Katz
car.katz <- katz.cent(car)
@ -195,7 +196,8 @@ tc_centralities[[2,1]] <- hipaa.tc.deg %>% sort(decreasing = T)
tc_centralities[[3,1]] <- pci.tc.deg %>% sort(decreasing = T)
car_tc_deg_Fn <- ( ecdf( car.tc.deg ))
car_plots[[2,1]] <- car_tc_deg_Fn(car.tc.deg)*100
#car_plots[[2,1]] <- car_tc_deg_Fn(car.tc.deg)*100
car_plots[[2,1]] <- car.tc.deg/max(car.tc.deg)
#### Katz
car.tc.katz <- katz.cent(car.tc)
@ -312,7 +314,8 @@ dtree_centralities[[2,1]] <- hipaa.dtree.deg %>% sort(decreasing = T)
dtree_centralities[[3,1]] <- pci.dtree.deg %>% sort(decreasing = T)
car_dt_deg_Fn <- ( ecdf( car.dtree.deg ))
car_plots[[3,1]] <- car_dt_deg_Fn(car.dtree.deg)*100
#car_plots[[3,1]] <- car_dt_deg_Fn(car.dtree.deg)*100
car_plots[[3,1]] <-car.dtree.deg/max(car.dtree.deg)
#### Katz
car.dtree.katz <- katz.cent(car.dtree)
@ -603,12 +606,19 @@ car_dtree_df <- as.data.frame(car_plots[[3,1]])
car_dtree_df$Node <- 1:nrow(as.data.frame(car_plots[[3,1]]))
colnames(car_dtree_df) <- c("Centrality", "Node")
fig1 <- plot_ly(x=car_base_df$Node, y=car_base_df$Centrality, type="bar")
fig2 <- plot_ly(x=car_base_df$Node, y=car_tc_df$Centrality, type="bar")
fig3 <- plot_ly(x=car_base_df$Node, y=car_dtree_df$Centrality, type="bar")
fig <- subplot(fig1, fig2, fig3, nrows = 3) %>%
layout(title = list(text = "Importance Distribution for Nodes
in the Automobile Maintenance Network"),
fig1 <- plot_ly(x=car_base_df$Node, y=car_base_df$Centrality, type="bar", name="Base Network") %>%
layout(xaxis = list(title = 'Node'))#, yaxis = list(title = 'Importance Percentile'))
# title=list(text="Base Network"))
fig2 <- plot_ly(x=car_base_df$Node, y=car_tc_df$Centrality, type="bar", name="Transitive Closure Network") %>%
layout(xaxis = list(title = 'Node'))#, yaxis = list(title = 'Importance Percentile'))
# title=list(text="Transitive Closure Network"))
fig3 <- plot_ly(x=car_base_df$Node, y=car_dtree_df$Centrality, type="bar", name="Dominant Tree Network")%>%
layout(xaxis = list(title = 'Node'))#, yaxis = list(title = 'Importance Percentile'))
# title=list(text="Dominant Tree Network"))
fig <- subplot(fig1, fig2, fig3, nrows = 3, shareX = TRUE, shareY = TRUE) %>%
layout(title = list(text = "Degree Centrality Importance Distribution for
Nodes in the Automobile Maintenance Network"),
plot_bgcolor='#e5ecf6',
xaxis = list(
zerolinecolor = '#ffff',
@ -617,7 +627,15 @@ fig <- subplot(fig1, fig2, fig3, nrows = 3) %>%
yaxis = list(
zerolinecolor = '#ffff',
zerolinewidth = 2,
gridcolor = 'ffff'))
gridcolor = 'ffff'),
annotations = list(
list(x = -0.1 , y = 0.5, text = "Node Importance/max(Importance)",
font = list(color = "black",size = 18),
textangle = 270,
showarrow = F, xref='paper', yref='paper', size=48)),
showlegend=T
)
fig
plot(car_plots[[1,1]], type="h", xlab="Node",