Submission network visualizationPlease find attached a network visualization of the current situation of submission in the Crypto Kingdom. Node sizes are linearly proportional to the amount of submission (base node size at 10, after that submission is incremented by the arrows with worth 1/2/3 to the receiver of submission). Attached is also the R-code to produce this plot, so it can be later extended by anyone.
EDIT: If and when things get more complicated, some more sophisticated network layout algorithms probably ought to be used, but for now a naive layout seems to work just fine.
R code:
# CK submit network visualization
submits <- data.frame(
ID = numeric(0), shortID = character(0), submitID = numeric(0), submission=numeric(0), stringsAsFactors=FALSE
)
# Add known submit commands to the data frame -- Confirmed, March 16
submits <- rbind(submits, data.frame(fromID = 91, fromName = "Angus", toID = 36, toName = "Zechariah", submission = 1, stringsAsFactors=FALSE))
submits <- rbind(submits, data.frame(fromID = 336, fromName = "goldbug", toID = 36, toName = "Zechariah", submission = 2, stringsAsFactors=FALSE))
submits <- rbind(submits, data.frame(fromID = 978, fromName = "Phoenix", toID = 36, toName = "Zechariah", submission = 3, stringsAsFactors=FALSE))
submits <- rbind(submits, data.frame(fromID = 1059, fromName = "toady", toID = 36, toName = "Zechariah", submission = 3, stringsAsFactors=FALSE))
submits <- rbind(submits, data.frame(fromID = 1032, fromName = "Rostibarn", toID = 36, toName = "Zechariah", submission = 3, stringsAsFactors=FALSE))
submits <- rbind(submits, data.frame(fromID = 36, fromName = "Zechariah", toID = 88, toName = "Mooo", submission = 1, stringsAsFactors=FALSE))
submits <- rbind(submits, data.frame(fromID = 138, fromName = "Syksy", toID = 88, toName = "Mooo", submission = 1, stringsAsFactors=FALSE))
submits <- rbind(submits, data.frame(fromID = 118, fromName = "Zephyrus", toID = 49, toName = "Church", submission = 3, stringsAsFactors=FALSE))
# Add unconfirmed submissions also
submits <- rbind(submits, data.frame(fromID = 31, fromName = "djjacket", toID = 36, toName = "Zechariah", submission = 3, stringsAsFactors=FALSE))
submits <- rbind(submits, data.frame(fromID = 94, fromName = "noms", toID = 36, toName = "Zechariah", submission = 3, stringsAsFactors=FALSE))
submits <- rbind(submits, data.frame(fromID = 88, fromName = "Mooo", toID = 36, toName = "Zechariah", submission = 1, stringsAsFactors=FALSE))
submits <- rbind(submits, data.frame(fromID = 130, fromName = "Crichton", toID = 36, toName = "Zechariah", submission = 2, stringsAsFactors=FALSE))
submits <- rbind(submits, data.frame(fromID = 200, fromName = "ChrisPop", toID = 36, toName = "Zechariah", submission = 2, stringsAsFactors=FALSE))
submits <- rbind(submits, data.frame(fromID = 215, fromName = "tombot", toID = 36, toName = "Zechariah", submission = 2, stringsAsFactors=FALSE))
submits <- rbind(submits, data.frame(fromID = 1047, fromName = "Deborah", toID = 36, toName = "Zechariah", submission = 3, stringsAsFactors=FALSE))
submits <- rbind(submits, data.frame(fromID = 29, fromName = "Luigi", toID = 36, toName = "Zechariah", submission = 1, stringsAsFactors=FALSE))
submits <- rbind(submits, data.frame(fromID = 211, fromName = "Erin", toID = 36, toName = "Zechariah", submission = 1, stringsAsFactors=FALSE))
submits <- rbind(submits, data.frame(fromID = 111, fromName = "goin2mars", toID = 36, toName = "Zechariah", submission = 3, stringsAsFactors=FALSE))
submits <- rbind(submits, data.frame(fromID = 7, fromName = "saddam", toID = 36, toName = "Zechariah", submission = 1, stringsAsFactors=FALSE))
submits <- rbind(submits, data.frame(fromID = 57, fromName = "Riddick", toID = 36, toName = "Zechariah", submission = 1, stringsAsFactors=FALSE))
submits <- rbind(submits, data.frame(fromID = 99, fromName = "Gabriel", toID = 36, toName = "Zechariah", submission = 1, stringsAsFactors=FALSE))
submits <- rbind(submits, data.frame(fromID = 230, fromName = "Gaben", toID = 36, toName = "Zechariah", submission = 1, stringsAsFactors=FALSE))
submits <- rbind(submits, data.frame(fromID = 1029, fromName = "Dannybreal", toID = 36, toName = "Zechariah", submission = 3, stringsAsFactors=FALSE))
# No rebellions to add but they could be red lines or something
# Start constructing the nodes and directional arrows
# igraph and related packages to plot the graph
# Need to use: install.packages("pkgName")
# if they are not already installed
library("igraph")
library("network")
library("sna")
library("ndtv")
# Nodes are all unique names from/to submission
nodes <- unique(c(submits[,"fromName"], submits[,"toName"]))
# Compute per each node the submission directed to it
sumsubmission <- unlist(lapply(nodes, FUN=function(z) {
sum(submits[which(submits[,"toName"]==z), "submission"])
}))
names(sumsubmission) <- nodes
# Set base node size to 10
sumsubmission <- sumsubmission + 10
links <- data.frame(from = submits[,"fromName"], to = submits[,"toName"], weight=1+submits[,"submission"])
g <- graph_from_data_frame(links, vertices=nodes, directed=TRUE)
# Adjust node sizes according to cumulative submission
V(g)$size[match(names(V(g)), names(sumsubmission))] <- sumsubmission
# Constant edge width, colouring will indicate level of submission
E(g)$width <- 3
# Make a color palette for submission
# Fine-tuning
edgepalette <- c("lightgrey", "darkgrey", "black")
E(g)$color <- edgepalette[submits[,"submission"]]
V(g)$color <- "tan"
V(g)$label.color <- "black"
V(g)$loop.angle <- 100
V(g)$label.dist <- 0
V(g)$label.cex <- 1.5
set.seed(1) # Reproducibility
# Plot the graph
png("Submit.png", width=1000, height=1000)
plot(g)
legend("topleft", col=edgepalette, lwd=3, legend=c("Submissive", "Most submissive", "Very submissive"), cex=1.5)
dev.off()