diff --git a/.Rhistory b/.Rhistory index 3dc0977..6d2283c 100644 --- a/.Rhistory +++ b/.Rhistory @@ -1,512 +1,512 @@ -g.breaks.clean <- g.breaks[nz.probs.mask] -g.probs.clean <- g.breaks[nz.probs.mask] -#plot(log(g.breaks.clean), log(g.probs.clean)) -g.fit <- lm(log(g.probs.clean)~log(g.breaks.clean)) -summary(g.fit) -alpha.LM <- coef(g.fit)[2] -lines(g.seq, g.seq^(-alpha.LM), col="#E66100", lty=3) -################# Max-Log-Likelihood ################# -n <- length(g.breaks.clean) -kmin <- g.breaks.clean[1] -alpha.ML <- 1 + n/sum(log(g.breaks.clean)/kmin) -alpha.ML -lines(g.seq, g.seq^(-alpha.ML), col="#D35FB7", lty=4) -# Homework 4 for the University of Tulsa' s CS-7863 Network Theory Course -# Degree Distribution -# Professor: Dr. McKinney, Spring 2022 -# Noah Schrick - 1492657 -library(igraph) -library(igraphdata) -data(yeast) -g <- yeast -g.netname <- "Yeast" -################# Set up Work ################# -g.vec <- degree(g) -g.hist <- hist(g.vec, freq=FALSE, main=paste("Histogram of the", g.netname, -" Network")) -legend("topright", c("Guess", "Poisson", "Least-Squares Fit", -"Max Log-Likelihood"), lty=c(1,2,3,4), col=c("#40B0A6", -"#006CD1", "#E66100", "#D35FB7")) -g.mean <- mean(g.vec) -g.seq <- 0:max(g.vec) # x-axis -################# Guessing Alpha ################# -alpha.guess <- 1.5 -lines(g.seq, g.seq^(-alpha.guess), col="#40B0A6", lty=1) -################# Poisson ################# -g.pois <- dpois(g.seq, g.mean, log=F) -lines(g.seq, g.pois, col="#006CD1", lty=2) -################# Linear model: Least-Squares Fit ################# -g.breaks <- g.hist$breaks[-c(1)] # remove 0 -g.probs <- g.hist$density[-1] # make lengths match -# Need to clean up probabilities that are 0 -nz.probs.mask <- g.probs!=0 -g.breaks.clean <- g.breaks[nz.probs.mask] -g.probs.clean <- g.breaks[nz.probs.mask] -#plot(log(g.breaks.clean), log(g.probs.clean)) -g.fit <- lm(log(g.probs.clean)~log(g.breaks.clean)) -summary(g.fit) -alpha.LM <- coef(g.fit)[2] -lines(g.seq, g.seq^(-alpha.LM), col="#E66100", lty=3) -################# Max-Log-Likelihood ################# -n <- length(g.breaks.clean) -kmin <- g.breaks.clean[1] -alpha.ML <- 1 + n/sum(log(g.breaks.clean)/kmin) -alpha.ML -lines(g.seq, g.seq^(-alpha.ML), col="#D35FB7", lty=4) -# Homework 4 for the University of Tulsa' s CS-7863 Network Theory Course -# Degree Distribution -# Professor: Dr. McKinney, Spring 2022 -# Noah Schrick - 1492657 -library(igraph) -library(igraphdata) -data(yeast) -g <- yeast -g.netname <- "Yeast" -################# Set up Work ################# -g.vec <- degree(g) -g.hist <- hist(g.vec, freq=FALSE, main=paste("Histogram of the", g.netname, -" Network")) -legend("topright", c("Guess", "Poisson", "Least-Squares Fit", -"Max Log-Likelihood"), lty=c(1,2,3,4), col=c("#40B0A6", -"#006CD1", "#E66100", "#D35FB7")) -g.mean <- mean(g.vec) -g.seq <- 0:max(g.vec) # x-axis -################# Guessing Alpha ################# -alpha.guess <- 1.5 -lines(g.seq, g.seq^(-alpha.guess), col="#40B0A6", lty=1) -################# Poisson ################# -g.pois <- dpois(g.seq, g.mean, log=F) -lines(g.seq, g.pois, col="#006CD1", lty=2) -################# Linear model: Least-Squares Fit ################# -g.breaks <- g.hist$breaks[-c(1,2)] # remove 0 -g.probs <- g.hist$density[-1] # make lengths match -# Need to clean up probabilities that are 0 -nz.probs.mask <- g.probs!=0 -g.breaks.clean <- g.breaks[nz.probs.mask] -g.probs.clean <- g.breaks[nz.probs.mask] -#plot(log(g.breaks.clean), log(g.probs.clean)) -g.fit <- lm(log(g.probs.clean)~log(g.breaks.clean)) -summary(g.fit) -alpha.LM <- coef(g.fit)[2] -lines(g.seq, g.seq^(-alpha.LM), col="#E66100", lty=3) -################# Max-Log-Likelihood ################# -n <- length(g.breaks.clean) -kmin <- g.breaks.clean[1] -alpha.ML <- 1 + n/sum(log(g.breaks.clean)/kmin) -alpha.ML -lines(g.seq, g.seq^(-alpha.ML), col="#D35FB7", lty=4) -# Homework 4 for the University of Tulsa' s CS-7863 Network Theory Course -# Degree Distribution -# Professor: Dr. McKinney, Spring 2022 -# Noah Schrick - 1492657 -library(igraph) -library(igraphdata) -data(yeast) -g <- yeast -g.netname <- "Yeast" -################# Set up Work ################# -g.vec <- degree(g) -g.hist <- hist(g.vec, freq=FALSE, main=paste("Histogram of the", g.netname, -" Network")) -legend("topright", c("Guess", "Poisson", "Least-Squares Fit", -"Max Log-Likelihood"), lty=c(1,2,3,4), col=c("#40B0A6", -"#006CD1", "#E66100", "#D35FB7")) -g.mean <- mean(g.vec) -g.seq <- 0:max(g.vec) # x-axis -################# Guessing Alpha ################# -alpha.guess <- 1.5 -lines(g.seq, g.seq^(-alpha.guess), col="#40B0A6", lty=1) -################# Poisson ################# -g.pois <- dpois(g.seq, g.mean, log=F) -lines(g.seq, g.pois, col="#006CD1", lty=2) -################# Linear model: Least-Squares Fit ################# -g.breaks <- g.hist$breaks[-c(1,2,3)] # remove 0 -g.probs <- g.hist$density[-1] # make lengths match -# Need to clean up probabilities that are 0 -nz.probs.mask <- g.probs!=0 -g.breaks.clean <- g.breaks[nz.probs.mask] -g.probs.clean <- g.breaks[nz.probs.mask] -#plot(log(g.breaks.clean), log(g.probs.clean)) -g.fit <- lm(log(g.probs.clean)~log(g.breaks.clean)) -summary(g.fit) -alpha.LM <- coef(g.fit)[2] -lines(g.seq, g.seq^(-alpha.LM), col="#E66100", lty=3) -################# Max-Log-Likelihood ################# -n <- length(g.breaks.clean) -kmin <- g.breaks.clean[1] -alpha.ML <- 1 + n/sum(log(g.breaks.clean)/kmin) -alpha.ML -lines(g.seq, g.seq^(-alpha.ML), col="#D35FB7", lty=4) -# Homework 4 for the University of Tulsa' s CS-7863 Network Theory Course -# Degree Distribution -# Professor: Dr. McKinney, Spring 2022 -# Noah Schrick - 1492657 -library(igraph) -library(igraphdata) -data(yeast) -g <- yeast -g.netname <- "Yeast" -################# Set up Work ################# -g.vec <- degree(g) -g.hist <- hist(g.vec, freq=FALSE, main=paste("Histogram of the", g.netname, -" Network")) -legend("topright", c("Guess", "Poisson", "Least-Squares Fit", -"Max Log-Likelihood"), lty=c(1,2,3,4), col=c("#40B0A6", -"#006CD1", "#E66100", "#D35FB7")) -g.mean <- mean(g.vec) -g.seq <- 0:max(g.vec) # x-axis -################# Guessing Alpha ################# -alpha.guess <- 1.5 -lines(g.seq, g.seq^(-alpha.guess), col="#40B0A6", lty=1) -################# Poisson ################# -g.pois <- dpois(g.seq, g.mean, log=F) -lines(g.seq, g.pois, col="#006CD1", lty=2) -################# Linear model: Least-Squares Fit ################# -g.breaks <- g.hist$breaks[-c(1)] # remove 0 -g.probs <- g.hist$density[-1] # make lengths match -# Need to clean up probabilities that are 0 -nz.probs.mask <- g.probs!=0 -g.breaks.clean <- g.breaks[nz.probs.mask] -g.probs.clean <- g.breaks[nz.probs.mask] -#plot(log(g.breaks.clean), log(g.probs.clean)) -g.fit <- lm(log(g.probs.clean)~log(g.breaks.clean)) -summary(g.fit) -alpha.LM <- coef(g.fit)[2] -lines(g.seq, g.seq^(-alpha.LM), col="#E66100", lty=3) -################# Max-Log-Likelihood ################# -n <- length(g.breaks.clean) -kmin <- g.breaks.clean[1] -alpha.ML <- 1 + n/sum(log(g.breaks.clean)/kmin) -alpha.ML -lines(g.seq, g.seq^(-alpha.ML), col="#D35FB7", lty=4) -# Homework 4 for the University of Tulsa' s CS-7863 Network Theory Course -# Degree Distribution -# Professor: Dr. McKinney, Spring 2022 -# Noah Schrick - 1492657 -library(igraph) -library(igraphdata) -data(yeast) -g <- yeast -g.netname <- "Yeast" -################# Set up Work ################# -g.vec <- degree(g) -g.hist <- hist(g.vec, freq=FALSE, main=paste("Histogram of the", g.netname, -" Network")) -legend("topright", c("Guess", "Poisson", "Least-Squares Fit", -"Max Log-Likelihood"), lty=c(1,2,3,4), col=c("#40B0A6", -"#006CD1", "#E66100", "#D35FB7")) -g.mean <- mean(g.vec) -g.seq <- 0:max(g.vec) # x-axis -################# Guessing Alpha ################# -alpha.guess <- 1.5 -lines(g.seq, g.seq^(-alpha.guess), col="#40B0A6", lty=1) -################# Poisson ################# -g.pois <- dpois(g.seq, g.mean, log=F) -lines(g.seq, g.pois, col="#006CD1", lty=2) -################# Linear model: Least-Squares Fit ################# -#g.breaks <- g.hist$breaks[-c(1)] # remove 0 -g.breaks <- g.hist$breaks # remove 0 -g.probs <- g.hist$density[-1] # make lengths match -# Need to clean up probabilities that are 0 -nz.probs.mask <- g.probs!=0 -g.breaks.clean <- g.breaks[nz.probs.mask] -g.probs.clean <- g.breaks[nz.probs.mask] -#plot(log(g.breaks.clean), log(g.probs.clean)) -g.fit <- lm(log(g.probs.clean)~log(g.breaks.clean)) -summary(g.fit) -alpha.LM <- coef(g.fit)[2] -lines(g.seq, g.seq^(-alpha.LM), col="#E66100", lty=3) -################# Max-Log-Likelihood ################# -n <- length(g.breaks.clean) -kmin <- g.breaks.clean[1] -alpha.ML <- 1 + n/sum(log(g.breaks.clean)/kmin) -alpha.ML -lines(g.seq, g.seq^(-alpha.ML), col="#D35FB7", lty=4) -# Homework 4 for the University of Tulsa' s CS-7863 Network Theory Course -# Degree Distribution -# Professor: Dr. McKinney, Spring 2022 -# Noah Schrick - 1492657 -library(igraph) -library(igraphdata) -data(yeast) -g <- yeast -g.netname <- "Yeast" -################# Set up Work ################# -g.vec <- degree(g) -g.hist <- hist(g.vec, freq=FALSE, main=paste("Histogram of the", g.netname, -" Network")) -legend("topright", c("Guess", "Poisson", "Least-Squares Fit", -"Max Log-Likelihood"), lty=c(1,2,3,4), col=c("#40B0A6", -"#006CD1", "#E66100", "#D35FB7")) -g.mean <- mean(g.vec) -g.seq <- 0:max(g.vec) # x-axis -################# Guessing Alpha ################# -alpha.guess <- 1.5 -lines(g.seq, g.seq^(-alpha.guess), col="#40B0A6", lty=1) -################# Poisson ################# -g.pois <- dpois(g.seq, g.mean, log=F) -lines(g.seq, g.pois, col="#006CD1", lty=2) -################# Linear model: Least-Squares Fit ################# -g.breaks <- g.hist$breaks[-c(1)] # remove 0 -g.probs <- g.hist$density[-1] # make lengths match -# Need to clean up probabilities that are 0 -nz.probs.mask <- g.probs!=0 -g.breaks.clean <- g.breaks[nz.probs.mask] -g.probs.clean <- g.probs[nz.probs.mask] -#plot(log(g.breaks.clean), log(g.probs.clean)) -g.fit <- lm(log(g.probs.clean)~log(g.breaks.clean)) -summary(g.fit) -alpha.LM <- coef(g.fit)[2] -lines(g.seq, g.seq^(-alpha.LM), col="#E66100", lty=3) -################# Max-Log-Likelihood ################# -n <- length(g.breaks.clean) -kmin <- g.breaks.clean[1] -alpha.ML <- 1 + n/sum(log(g.breaks.clean)/kmin) -alpha.ML -lines(g.seq, g.seq^(-alpha.ML), col="#D35FB7", lty=4) -alpha.LM -# Homework 4 for the University of Tulsa' s CS-7863 Network Theory Course -# Degree Distribution -# Professor: Dr. McKinney, Spring 2022 -# Noah Schrick - 1492657 -library(igraph) -library(igraphdata) -data(yeast) -g <- yeast -g.netname <- "Yeast" -################# Set up Work ################# -g.vec <- degree(g) -g.hist <- hist(g.vec, freq=FALSE, main=paste("Histogram of the", g.netname, -" Network")) -legend("topright", c("Guess", "Poisson", "Least-Squares Fit", -"Max Log-Likelihood"), lty=c(1,2,3,4), col=c("#40B0A6", -"#006CD1", "#E66100", "#D35FB7")) -g.mean <- mean(g.vec) -g.seq <- 0:max(g.vec) # x-axis -################# Guessing Alpha ################# -alpha.guess <- 1.5 -lines(g.seq, g.seq^(-alpha.guess), col="#40B0A6", lty=1) -################# Poisson ################# -g.pois <- dpois(g.seq, g.mean, log=F) -lines(g.seq, g.pois, col="#006CD1", lty=2) -################# Linear model: Least-Squares Fit ################# -g.breaks <- g.hist$breaks[-c(1)] # remove 0 -g.probs <- g.hist$density[-1] # make lengths match -# Need to clean up probabilities that are 0 -nz.probs.mask <- g.probs!=0 -g.breaks.clean <- g.breaks[nz.probs.mask] -g.probs.clean <- g.probs[nz.probs.mask] -#plot(log(g.breaks.clean), log(g.probs.clean)) -g.fit <- lm(log(g.probs.clean)~log(g.breaks.clean)) -summary(g.fit) -alpha.LM <- coef(g.fit)[2] -lines(g.seq, g.seq^(-alpha.LM), col="#E66100", lty=3) -################# Max-Log-Likelihood ################# -n <- length(g.breaks.clean) -kmin <- g.breaks.clean[1] -alpha.ML <- 1 + n/sum(log(g.breaks.clean/kmin)) -alpha.ML -lines(g.seq, g.seq^(-alpha.ML), col="#D35FB7", lty=4) -# Homework 4 for the University of Tulsa' s CS-7863 Network Theory Course -# Degree Distribution -# Professor: Dr. McKinney, Spring 2022 -# Noah Schrick - 1492657 -library(igraph) -library(igraphdata) -data(yeast) -g <- yeast -g.netname <- "Yeast" -################# Set up Work ################# -g.vec <- degree(g) -g.hist <- hist(g.vec, freq=FALSE, main=paste("Histogram of the", g.netname, -" Network")) -legend("topright", c("Guess", "Poisson", "Least-Squares Fit", -"Max Log-Likelihood"), lty=c(1,2,3,4), col=c("#40B0A6", -"#006CD1", "#E66100", "#D35FB7")) -g.mean <- mean(g.vec) -g.seq <- 0:max(g.vec) # x-axis -################# Guessing Alpha ################# -alpha.guess <- 1.5 -lines(g.seq, g.seq^(-alpha.guess), col="#40B0A6", lty=1, lwd=5) -################# Poisson ################# -g.pois <- dpois(g.seq, g.mean, log=F) -lines(g.seq, g.pois, col="#006CD1", lty=2) -################# Linear model: Least-Squares Fit ################# -g.breaks <- g.hist$breaks[-c(1)] # remove 0 -g.probs <- g.hist$density[-1] # make lengths match -# Need to clean up probabilities that are 0 -nz.probs.mask <- g.probs!=0 -g.breaks.clean <- g.breaks[nz.probs.mask] -g.probs.clean <- g.probs[nz.probs.mask] -#plot(log(g.breaks.clean), log(g.probs.clean)) -g.fit <- lm(log(g.probs.clean)~log(g.breaks.clean)) -summary(g.fit) -alpha.LM <- coef(g.fit)[2] -lines(g.seq, g.seq^(-alpha.LM), col="#E66100", lty=3) -################# Max-Log-Likelihood ################# -n <- length(g.breaks.clean) -kmin <- g.breaks.clean[1] -alpha.ML <- 1 + n/sum(log(g.breaks.clean/kmin)) -alpha.ML -lines(g.seq, g.seq^(-alpha.ML), col="#D35FB7", lty=4) -# Homework 4 for the University of Tulsa' s CS-7863 Network Theory Course -# Degree Distribution -# Professor: Dr. McKinney, Spring 2022 -# Noah Schrick - 1492657 -library(igraph) -library(igraphdata) -data(yeast) -g <- yeast -g.netname <- "Yeast" -################# Set up Work ################# -g.vec <- degree(g) -g.hist <- hist(g.vec, freq=FALSE, main=paste("Histogram of the", g.netname, -" Network")) -legend("topright", c("Guess", "Poisson", "Least-Squares Fit", -"Max Log-Likelihood"), lty=c(1,2,3,4), col=c("#40B0A6", -"#006CD1", "#E66100", "#D35FB7")) -g.mean <- mean(g.vec) -g.seq <- 0:max(g.vec) # x-axis -################# Guessing Alpha ################# -alpha.guess <- 1.5 -lines(g.seq, g.seq^(-alpha.guess), col="#40B0A6", lty=1, lwd=3) -################# Poisson ################# -g.pois <- dpois(g.seq, g.mean, log=F) -lines(g.seq, g.pois, col="#006CD1", lty=2) -################# Linear model: Least-Squares Fit ################# -g.breaks <- g.hist$breaks[-c(1)] # remove 0 -g.probs <- g.hist$density[-1] # make lengths match -# Need to clean up probabilities that are 0 -nz.probs.mask <- g.probs!=0 -g.breaks.clean <- g.breaks[nz.probs.mask] -g.probs.clean <- g.probs[nz.probs.mask] -#plot(log(g.breaks.clean), log(g.probs.clean)) -g.fit <- lm(log(g.probs.clean)~log(g.breaks.clean)) -summary(g.fit) -alpha.LM <- coef(g.fit)[2] -lines(g.seq, g.seq^(-alpha.LM), col="#E66100", lty=3) -################# Max-Log-Likelihood ################# -n <- length(g.breaks.clean) -kmin <- g.breaks.clean[1] -alpha.ML <- 1 + n/sum(log(g.breaks.clean/kmin)) -alpha.ML -lines(g.seq, g.seq^(-alpha.ML), col="#D35FB7", lty=4) -# Homework 4 for the University of Tulsa' s CS-7863 Network Theory Course -# Degree Distribution -# Professor: Dr. McKinney, Spring 2022 -# Noah Schrick - 1492657 -library(igraph) -library(igraphdata) -data(yeast) -g <- yeast -g.netname <- "Yeast" -################# Set up Work ################# -g.vec <- degree(g) -g.hist <- hist(g.vec, freq=FALSE, main=paste("Histogram of the", g.netname, -" Network")) -legend("topright", c("Guess", "Poisson", "Least-Squares Fit", -"Max Log-Likelihood"), lty=c(1,2,3,4), col=c("#40B0A6", -"#006CD1", "#E66100", "#D35FB7")) -g.mean <- mean(g.vec) -g.seq <- 0:max(g.vec) # x-axis -################# Guessing Alpha ################# -alpha.guess <- 1.5 -lines(g.seq, g.seq^(-alpha.guess), col="#40B0A6", lty=1, lwd=3) -################# Poisson ################# -g.pois <- dpois(g.seq, g.mean, log=F) -lines(g.seq, g.pois, col="#006CD1", lty=2, lwd=3) -################# Linear model: Least-Squares Fit ################# -g.breaks <- g.hist$breaks[-c(1)] # remove 0 -g.probs <- g.hist$density[-1] # make lengths match -# Need to clean up probabilities that are 0 -nz.probs.mask <- g.probs!=0 -g.breaks.clean <- g.breaks[nz.probs.mask] -g.probs.clean <- g.probs[nz.probs.mask] -#plot(log(g.breaks.clean), log(g.probs.clean)) -g.fit <- lm(log(g.probs.clean)~log(g.breaks.clean)) -summary(g.fit) -alpha.LM <- coef(g.fit)[2] -lines(g.seq, g.seq^(-alpha.LM), col="#E66100", lty=3, lwd=3) -################# Max-Log-Likelihood ################# -n <- length(g.breaks.clean) -kmin <- g.breaks.clean[1] -alpha.ML <- 1 + n/sum(log(g.breaks.clean/kmin)) -alpha.ML -lines(g.seq, g.seq^(-alpha.ML), col="#D35FB7", lty=4, lwd=3) -plot(yeast) -hist(yeast) -hist(g.vec) -g.pois -g.mean -alpha.LM -alpha.ML -degree(g) -sort(degree(g)) -sort(degree(g),decreasing=FALSE) -sort(degree(g),decreasing=F) -sort(degree(g),decreasing=false) -sort(degree(g), decreasing = TRUE) -head(sort(degree(g), decreasing = TRUE)) -stddev(degree(g)) -sd(degree(g)) -tail(sort(degree(g), decreasing = TRUE)) -plot(log(g.breaks.clean), log(g.probs.clean)) -# Homework 4 for the University of Tulsa' s CS-7863 Network Theory Course -# Degree Distribution -# Professor: Dr. McKinney, Spring 2022 -# Noah Schrick - 1492657 -library(igraph) -library(igraphdata) -data(yeast) -g <- yeast -g.netname <- "Yeast" -################# Set up Work ################# -g.vec <- degree(g) -g.hist <- hist(g.vec, freq=FALSE, main=paste("Histogram of the", g.netname, -" Network")) -legend("topright", c("Guess", "Poisson", "Least-Squares Fit", -"Max Log-Likelihood"), lty=c(1,2,3,4), col=c("#40B0A6", -"#006CD1", "#E66100", "#D35FB7")) -g.mean <- mean(g.vec) -g.seq <- 0:max(g.vec) # x-axis -################# Guessing Alpha ################# -alpha.guess <- 1.5 -lines(g.seq, g.seq^(-alpha.guess), col="#40B0A6", lty=1, lwd=3) -################# Poisson ################# -g.pois <- dpois(g.seq, g.mean, log=F) -lines(g.seq, g.pois, col="#006CD1", lty=2, lwd=3) -################# Linear model: Least-Squares Fit ################# -g.breaks <- g.hist$breaks[-c(1)] # remove 0 -g.probs <- g.hist$density[-1] # make lengths match -# Need to clean up probabilities that are 0 -nz.probs.mask <- g.probs!=0 -g.breaks.clean <- g.breaks[nz.probs.mask] -g.probs.clean <- g.probs[nz.probs.mask] -plot(log(g.breaks.clean), log(g.probs.clean)) -g.fit <- lm(log(g.probs.clean)~log(g.breaks.clean)) -summary(g.fit) -alpha.LM <- coef(g.fit)[2] -lines(g.seq, g.seq^(-alpha.LM), col="#E66100", lty=3, lwd=3) -################# Max-Log-Likelihood ################# -n <- length(g.breaks.clean) -kmin <- g.breaks.clean[1] -alpha.ML <- 1 + n/sum(log(g.breaks.clean/kmin)) -alpha.ML -lines(g.seq, g.seq^(-alpha.ML), col="#D35FB7", lty=4, lwd=3) -plot(log(g.breaks.clean), log(g.probs.clean)) -g.breaks.clean <- g.breaks[nz.probs.mask] -g.probs.clean <- g.probs[nz.probs.mask] -plot(log(g.breaks.clean), log(g.probs.clean)) -graphvizCapabilities()$layoutTypes -library(igraph) -library(sna) -library(Rgraphviz) # Reading graphviz' "dot" files -graphvizCapabilities()$layoutTypes -car.adj <- agread("./CG_Files/Network_1/DOTFILE.dot", layoutType="dot",layout=FALSE) # Large: ~1.9G -################# Read in the previously generated networks ################# -# If sourcing: -#setwd(getSrcDirectory()[1]) -# If running: -setwd(dirname(rstudioapi::getActiveDocumentContext()$path)) -car.adj <- agread("./CG_Files/Network_1/DOTFILE.dot", layoutType="dot",layout=FALSE) # Large: ~1.9G -plot(car.adj) +V(hipaa.tc)$color <- ifelse(hipaa.tc.l_clusters>0, "green", "yellow") +plot(hipaa.tc, main=paste(hipaa.tc.netname, "Laplace Spectral Clustering"), vertex.label=NA) +pci.tc.eigs <- Re(eigen(pci.tc.Lap)$vectors[,pci.tc.n-1]) +pci.tc.eig_val <- eigen(pci.tc.Lap)$values[pci.tc.n-1] +names(pci.tc.eigs) <- names(V(pci.tc)) +pci.tc.l_clusters <- ifelse(pci.tc.eigs>0,1,-1) +tc_clusters[[3,1]] <- pci.tc.l_clusters +V(pci.tc)$color <- ifelse(pci.tc.l_clusters>0, "green", "yellow") +plot(pci.tc, main=paste(pci.tc.netname, "Laplace Spectral Clustering"), vertex.label=NA) +### Clemente and Grassi +tc_clusters[[1,2]] <- ClustBCG(as.matrix(car.tc.adj), "directed")$totalCC +tc_clusters[[2,2]] <- ClustBCG(as.matrix(hipaa.tc.adj), "directed")$totalCC +tc_clusters[[3,2]] <- ClustBCG(as.matrix(pci.tc.adj), "directed")$totalCC +######################### Dominant Tree Centralities ######################### +dtree_centralities <- matrix(list(), nrow=3, ncol=5) +rownames(dtree_centralities) <- c(car.netname, hipaa.netname, pci.netname) +colnames(dtree_centralities) <- c("Degree", "Katz", "Page Rank", "K-path", "Betweenness") +# Get basic network attributes +car.dtree.adj <- get.adjacency(car.dtree) +car.dtree.deg <- rowSums(as.matrix(car.dtree.adj)) # degree +car.dtree.n <- length(V(car.dtree)) +hipaa.dtree.adj <- get.adjacency(hipaa.dtree) +hipaa.dtree.deg <- rowSums(as.matrix(hipaa.dtree.adj)) # degree +hipaa.dtree.n <- length(V(hipaa.dtree)) +pci.dtree.adj <- get.adjacency(pci.dtree) +pci.dtree.deg <- rowSums(as.matrix(pci.dtree.adj)) # degree +pci.dtree.n <- length(V(pci.dtree)) +### Degree +dtree_centralities[[1,1]] <- car.dtree.deg %>% sort(decreasing = T) +dtree_centralities[[2,1]] <- hipaa.dtree.deg %>% sort(decreasing = T) +dtree_centralities[[3,1]] <- pci.dtree.deg %>% sort(decreasing = T) +#### Katz +car.dtree.katz <- katz.cent(car.dtree) +dtree_centralities[[1,2]] <- car.dtree.katz[rowSums(apply(car.dtree.katz,2,is.nan))==0,] %>% sort(decreasing = T) +dtree_centralities[[2,2]] <- katz.cent(hipaa.dtree) %>% sort(decreasing = T) +dtree_centralities[[3,2]] <- katz.cent(pci.dtree) %>% sort(decreasing = T) +### Page Rank +dtree_centralities[[1,3]] <- page.rank(car.dtree)$vector %>% sort(decreasing = T) +dtree_centralities[[2,3]] <- page.rank(hipaa.dtree)$vector %>% sort(decreasing = T) +dtree_centralities[[3,3]] <- page.rank(pci.dtree)$vector %>% sort(decreasing = T) +### K-path +dtree_centralities[[1,4]] <- geokpath(car.dtree, V(car.dtree), "out") %>% sort(decreasing = T) +dtree_centralities[[2,4]] <- geokpath(hipaa.dtree, V(hipaa.dtree), "out") %>% sort(decreasing = T) +dtree_centralities[[3,4]] <- geokpath(pci.dtree, V(pci.dtree), "out") %>% sort(decreasing = T) +### Betweenness +dtree_centralities[[1,5]] <- betweenness(car.dtree, TRUE) %>% sort(decreasing = T) +dtree_centralities[[2,5]] <- betweenness(hipaa.dtree, TRUE) %>% sort(decreasing = T) +dtree_centralities[[3,5]] <- betweenness(pci.dtree, TRUE) %>% sort(decreasing = T) +########################## Dominant Tree Clustering ########################## +source("self_newman_mod.R") +dtree_clusters <- matrix(list(), nrow=3, ncol=2) +rownames(dtree_centralities) <- c(car.netname, hipaa.netname, pci.netname) +colnames(dtree_centralities) <- c("Laplace", "CG") +### Laplacian +car.dtree.Lap <- diag(car.dtree.deg) - car.dtree.adj # L = D-A +hipaa.dtree.Lap <- diag(hipaa.dtree.deg) - hipaa.dtree.adj +pci.dtree.Lap <- diag(pci.dtree.deg) - pci.dtree.adj +# get eigvals and vecs +car.dtree.eigs <- Re(eigen(car.dtree.Lap)$vectors[,car.dtree.n-1]) +car.dtree.eig_val <- eigen(car.dtree.Lap)$values[car.dtree.n-1] +names(car.dtree.eigs) <- names(V(car.dtree)) +car.dtree.l_clusters <- ifelse(car.dtree.eigs>0,1,-1) +dtree_clusters[[1,1]] <- car.dtree.l_clusters +V(car.dtree)$color <- ifelse(car.dtree.l_clusters>0, "green", "yellow") +plot(car.dtree, main=paste(car.dtree.netname, "Laplace Spectral Clustering"), vertex.label=NA) +hipaa.dtree.eigs <- Re(eigen(hipaa.dtree.Lap)$vectors[,hipaa.dtree.n-1]) +hipaa.dtree.eig_val <- eigen(hipaa.dtree.Lap)$values[hipaa.dtree.n-1] +names(hipaa.dtree.eigs) <- names(V(hipaa.dtree)) +hipaa.dtree.l_clusters <- ifelse(hipaa.dtree.eigs>0,1,-1) +dtree_clusters[[2,1]] <- hipaa.dtree.l_clusters +V(hipaa.dtree)$color <- ifelse(hipaa.dtree.l_clusters>0, "green", "yellow") +plot(hipaa.dtree, main=paste(hipaa.dtree.netname, "Laplace Spectral Clustering"), vertex.label=NA) +pci.dtree.eigs <- Re(eigen(pci.dtree.Lap)$vectors[,pci.dtree.n-1]) +pci.dtree.eig_val <- eigen(pci.dtree.Lap)$values[pci.dtree.n-1] +names(pci.dtree.eigs) <- names(V(pci.dtree)) +pci.dtree.l_clusters <- ifelse(pci.dtree.eigs>0,1,-1) +dtree_clusters[[3,1]] <- pci.dtree.l_clusters +V(pci.dtree)$color <- ifelse(pci.dtree.l_clusters>0, "green", "yellow") +plot(pci.dtree, main=paste(pci.dtree.netname, "Laplace Spectral Clustering"), vertex.label=NA) +### Clemente and Grassi +dtree_clusters[[1,2]] <- ClustBCG(as.matrix(car.dtree.adj), "directed")$totalCC +dtree_clusters[[2,2]] <- ClustBCG(as.matrix(hipaa.dtree.adj), "directed")$totalCC +dtree_clusters[[3,2]] <- ClustBCG(as.matrix(pci.dtree.adj), "directed")$totalCC +############################# Write Final Results ############################# +write.table(base_centralities, file='results.csv') +write.table(tc_centralities, file='results.csv') +write.table(dtree_centralities, file='results.csv') +### Degree: +head(base_centralities[[1,1]], 15) #Car +head(tc_centralities[[1,1]],15) +head(dtree_centralities[[1,1]],15) +head(base_centralities[[2,1]], 15) #HIPAA +head(tc_centralities[[2,1]],15) +head(dtree_centralities[[2,1]],15) +head(base_centralities[[3,1]], 15) #PCI +head(tc_centralities[[3,1]],15) +head(dtree_centralities[[3,1]],15) +### Katz: +head(base_centralities[[1,2]], 15) #Car +head(tc_centralities[[1,2]],15) +head(dtree_centralities[[1,2]],15) +head(base_centralities[[2,2]], 15) #HIPAA +head(tc_centralities[[2,2]],15) +head(dtree_centralities[[2,2]],15) +head(base_centralities[[3,2]], 15) #PCI +head(tc_centralities[[3,2]],15) +head(dtree_centralities[[3,2]],15) +### Page Rank: +head(base_centralities[[1,3]], 15) #Car +head(tc_centralities[[1,3]],15) +head(dtree_centralities[[1,3]],15) +head(base_centralities[[2,3]], 15) #HIPAA +head(tc_centralities[[2,3]],15) +head(dtree_centralities[[2,3]],15) +head(base_centralities[[3,3]], 15) #PCI +head(tc_centralities[[3,3]],15) +head(dtree_centralities[[3,3]],15) +### K-Path: +head(base_centralities[[1,4]], 15) #Car +head(tc_centralities[[1,4]],15) +head(dtree_centralities[[1,4]],15) +head(base_centralities[[2,4]], 15) #HIPAA +head(tc_centralities[[2,4]],15) +head(dtree_centralities[[2,4]],15) +head(base_centralities[[3,4]], 15) #PCI +head(tc_centralities[[3,4]],15) +head(dtree_centralities[[3,4]],15) +### Betweenness: +head(base_centralities[[1,5]], 15) #Car +head(tc_centralities[[1,5]],15) +head(dtree_centralities[[1,5]],15) +head(base_centralities[[2,5]], 15) #HIPAA +head(tc_centralities[[2,5]],15) +head(dtree_centralities[[2,5]],15) +head(base_centralities[[3,5]], 15) #PCI +head(tc_centralities[[3,5]],15) +head(dtree_centralities[[3,5]],15) +### Laplacian: +head(base_clusters[[1,1]], 15) #Car +head(tc_centralities[[1,1]],15) +head(dtree_centralities[[1,1]],15) +head(base_clusters[[2,1]], 15) #HIPAA +head(tc_centralities[[2,1]],15) +head(dtree_centralities[[2,1]],15) +head(base_clusters[[3,1]], 15) #PCI +head(tc_centralities[[3,1]],15) +head(dtree_centralities[[3,1]],15) +### CG: +head(base_clusters[[1,2]], 15) #Car +head(tc_centralities[[1,2]],15) +head(dtree_centralities[[1,2]],15) +head(base_clusters[[2,2]], 15) #HIPAA +head(tc_centralities[[2,2]],15) +head(dtree_centralities[[2,2]],15) +head(base_clusters[[3,2]], 15) #PCI +head(tc_centralities[[3,2]],15) +head(dtree_centralities[[3,2]],15) +head(base_centralities[[2,2]], 15) #HIPAA +### Page Rank: +head(base_centralities[[1,3]], 15) #Car +### Page Rank: +as.matrix(head(base_centralities[[1,3]], 15) #Car) +) +### Page Rank: +as.matrix(head(base_centralities[[1,3]], 15))[2] +### Page Rank: +as.matrix(head(base_centralities[[1,3]], 15)) +### Page Rank: +as.matrix(head(base_centralities[[1,3]], 15))[,1] +### Page Rank: +as.matrix(head(base_centralities[[1,3]], 15))[,2] +### Page Rank: +as.matrix(head(base_centralities[[1,3]], 15))[1,] +### Page Rank: +as.matrix(head(base_centralities[[1,3]], 15))[2,] +### Page Rank: +as.matrix(head(base_centralities[[1,3]], 15)) +### Page Rank: +as.matrix(head(tc_centralities[[1,3]], 15)) +### Page Rank: +as.matrix(head(base_centralities[[2,3]], 15)) +### Page Rank: +as.matrix(head(tc_centralities[[2,3]], 15)) +### Page Rank: +as.matrix(head(dtree_centralities[[2,3]], 15)) +### Page Rank: +as.matrix(head(dtree_centralities[[3,3]], 15)) +### Page Rank: +as.matrix(head(tc_centralities[[3,3]], 15)) +### Page Rank: +as.matrix(head(base_centralities[[3,3]], 15)) +head(tc_centralities[[1,4]],15) +### Page Rank: +as.matrix(as.matrix(head(base_centralities[[3,3]], 15))) +as.matrix(head(tc_centralities[[1,4]],15)) +as.matrix(head(base_centralities[[2,4]],15)) +as.matrix(head(tc_centralities[[2,4]],15)) +as.matrix(head(dtree_centralities[[2,4]],15)) +as.matrix(head(base_centralities[[3,4]],15)) +as.matrix(head(tc_centralities[[3,4]],15)) +as.matrix(head(dtree_centralities[[3,4]],15)) +as.matrix(head(base_centralities[[1,5]], 15)) +as.matrix(head(tc_centralities[[1,5]], 15)) +as.matrix(head(dtree_centralities[[1,5]], 15)) +as.matrix(head(dtree_centralities[[2,5]], 15)) +as.matrix(head(tc_centralities[[2,5]], 15)) +as.matrix(head(base_centralities[[2,5]], 15)) +as.matrix(head(base_centralities[[3,5]], 15)) +as.matrix(head(base_centralities[[2,5]], 15)) +as.matrix(head(tc_centralities[[3,5]], 15)) +as.matrix(head(dtree_centralities[[3,5]], 15)) +edge_connectivity(car) +edge_connectivity(hipaa) +edge_connectivity(pci) +edge_connectivity(car, "0", "2490") +Vcount(car) +ecount(car) +vcount(car) +ecount(hipaa) +vcount(hipaa) +vcount(pci) +ecount(pci\) +ecount(pci) +mean(base_centralities[[1,1]]) +mean(base_centralities[[1,1]])/vcount(car) +100*mean(base_centralities[[1,1]])/vcount(car) +100*mean(base_centralities[[2,1]])/vcount(hipaa) +100*mean(base_centralities[[3,1]])/vcount(pci) +katzcent(car,,0.9) +katzcent(car,,0.1) +as.matrix(head(katzcent(car,,0.1) %>% sort(decreasing=T), 15)) +as.matrix(head(katzcent(car.tc,,0.1) %>% sort(decreasing=T), 15)) +as.matrix(head(katzcent(car.dtree,,0.1) %>% sort(decreasing=T), 15)) +as.matrix(head(katzcent(car.dtree,,0.1) %>% sort(decreasing=T), 45)) +as.matrix(head(katzcent(hipaa,,0.1) %>% sort(decreasing=T), 15)) +as.matrix(head(Re(katzcent(hipaa,,0.1)) %>% sort(decreasing=T), 15)) +katzcent(hipaa,,0.1) +as.matrix(head(katzcent(pci,,0.1) %>% sort(decreasing=T), 15)) +katzcent(pci,,0.1) +katz.cent(pci) +katz.cent(pci) %>% sort(decreasing = %) +katz.cent(pci) %>% sort(decreasing = T) +head(base_centralities[[2,2]], 15) #HIPAA +base_centralities[[2,2]] +order(base_centralities[[2,2]],decreasing=T) +order(tc_centralities[[2,2]],decreasing=T) +tc_centralities[[2,2]] +katz.cent(pci) +order(katz.cent(pci)) +sort(katz.cent(pci))[60] +sort(katz.cent(pci))[47] +sort(katz.cent(pci))[61] +sort(katz.cent(pci))[56] +sort(katz.cent(pci))[54] +sort(katz.cent(pci))[58] +sort(katz.cent(pci))[53] +sort(katz.cent(pci))[57] +sort(katz.cent(pci))[45] +sort(katz.cent(pci))[44] +sort(katz.cent(pci))[32] +sort(katz.cent(pci)) +order(katz.pci, decreasing=T) +order(katz.cent(pci), decreasing=T) +head(order(katz.cent(pci), decreasing=T), 15) +katz.cent(pci)[1] +katz.cent(pci)[2] +katz.cent(pci)[5] +katz.cent(pci)[12] +katz.cent(pci)[23] +katz.cent(pci)[4] +katz.cent(pci)[11] +katz.cent(pci)[22] +katz.cent(pci)[36] +katz.cent(pci)[3] +katz.cent(pci)[9] +katz.cent(pci)[20] +katz.cent(pci)[34] +katz.cent(pci)[39] +katz.cent(pci)[26] +order(katz.cent(pci.tc), decreasing=T) +order(katz.cent(pci.tc), decreasing=T) %>% sort() +order(katz.cent(pci.tc), decreasing=T) %>% sort(katz.cent(pci.tc),decreasing=T)[] +order(katz.cent(pci.tc), decreasing=T) %>%katz.cent[] +order(katz.cent(pci.tc), decreasing=T) %>%katz.cent(pci.tc)[] +order(katz.cent(pci.tc), decreasing=T) +katz.cent(pci.tc)[0] +katz.cent(pci.tc)[1] +katz.cent(pci.tc)[2] +katz.cent(pci.tc)[6] +katz.cent(pci.tc)[5] +katz.cent(pci.tc)[12] +katz.cent(pci.tc)[23] +katz.cent(pci.tc)[3] +katz.cent(pci.tc)[4] +katz.cent(pci.tc)[9] +katz.cent(pci.tc)[20] +katz.cent(pci.tc)[34] +katz.cent(pci.tc)[11] +katz.cent(pci.tc)[22] +katz.cent(pci.tc)[36] +katz.cent(pci.tc)[8] +katz.cent(pci.tc)[39] +order(katz.cent(pci.dtree), decreasing=T +) +order(katz.cent(pci.dtree), decreasing=T) +order(katz.cent(pci.tc), decreasing=T) +order(katz.cent(pci.dtree), decreasing=T) +katz.cent(pci.dtree) +katzcent(pci.dtree) +katzcent(pci.dtree,,0.1) +katzcent(pci.dtree,,0.9) +katzcent(pci.dtree,,0.2) +katzcent(pci.dtree,,0.1) +katz.cent(pci.dtree) +katz.cent.adj +pci.dtree.adj +eigen(pci.dtree.adj)$values[1] +katz.cent(pci.dtree, 0.9) +katz.cent(pci.tc, 0.9) +katz.cent(pci.tc, 0.1) +katz.cent(pci.dtree, 0.1) +sort(katz.cent(pci.dtree, 0.1), decreasing=T) +sort(katz.cent(pci.dtree, 0.1), decreasing=T, index.return=T) +sort(katz.cent(pci.dtree, 0.1), decreasing=T, index.return=T)$x +sort(katz.cent(pci.dtree, 0.1), decreasing=T, index.return=T)$ix +sort(katz.cent(pci.dtree, 0.1), decreasing=T, index.return=TRUE) +sort(katz.cent(pci.dtree, 0.1), decreasing=T, index.return=TRUE)$x +sort.index(katz.cent(pci.dtree,0.1),decreasing=T) +tmp <- katz.cent(pci.dtree,0.1) +sort(tmp, decreasing=T, index.return=T) +tmp$x +tmp2 <- sort(tmp, decreasing=T, index.return=T) +tmp2 +tmp2$x +tmp2$ix +tmp2[1] +tmp2 <- sort(tmp, decreasing=T, index.return=TRUE) +tmp2$ix +tmp2 +tmp2 <- sort(tmp, index.return=TRUE, decreasing=T) +tmp21 +tmp2 +tmp2$ix +tmp2 <- sort(tmp, index.return=TRUE) +tmp2 +tmp2$ix +tmp2$x +tmp <- matrix(list(), nrow=vcount(car), ncol=2) +tmp[,1] <- car.katz %>% sort(,decreasing=T) +tmp[,1] <- car.katz %>% sort(decreasing=T) +tmp[1] <- car.katz %>% sort(decreasing=T) +tmp[[,1]] <- car.katz %>% sort(decreasing=T) +nodes <- car.katz %>% sort(decreasing=T) +car.katz +car.katz(car,.9) +car.katz<- katz.cent(car,.9) +car.katz[2488] +car.katz[1] +car.katz[5] +car.katz +is.na(eigen(car.adj)$values[1]) +eigen(car.adj)$values[1] +eigen(car.adj)$values[1] == 0 +############################# Base Centralities ############################# +source("centralities.R") +############################# Base Centralities ############################# +source("centralities.R") +katz.cent(car) +############################# Base Centralities ############################# +source("centralities.R") +katz.cent(car) +#### Katz +car.katz <- katz.cent(car) +nodes <- car.katz %>% sort(decreasing=T) +vals <- car.katz %>% order(decreasing=T) +head(nodes,15) +as.matrix(head(nodes,15)) +as.matrix(head(nodes,15), head(vals, 15)) +as.matrix(head(vals,15)) +as.matrix(head(vals,15)-1) +as.data.frame(head(vals,15)-1, head(nodes,15)) +as.data.frame(head(vals,15), head(nodes,15)) +nodes <- car.katz %>% sort(decreasing=T) +nodes <- car.katz %>% order(decreasing=T) +vals <- car.katz %>% sort(decreasing=T) +head(nodes,15) +head(vals,15) +as.data.frame(head(nodes,15), head(vals, 15)) +nodes <- car.katz %>% order(decreasing=T) +nodes <- head(nodes, 15) +nodes +nodes <- car.katz %>% order(decreasing=T) +nodes <- head(nodes, 15)-1 +nodes +vals <- head(vals, 15) +as.data.frame(nodes, vals) +as.matrix(nodes, vals) +print(cbind(nodes, vals)) +print(cbind(nodes, vals))$nodes +tmp <- (cbind(nodes, vals)) +tmp +prmatrix(tmp) +nodes +as.matrix(nodes) +as.matrix(nodes)[1] +as.matrix(nodes)[,1] +vals +as.matrix(vals) +#### Katz +car.katz <- katz.cent(car) +nodes <- car.katz %>% order(decreasing=T) +nodes <- head(nodes, 15)-1 +vals <- car.katz %>% sort(decreasing=T) +vals <- head(vals, 15) +nodes +vals +as.matrix(vals) +############################# Base Centralities ############################# +source("centralities.R") +#### Katz +car.katz <- katz.cent(car) +nodes <- car.katz %>% order(decreasing=T) +nodes <- head(nodes, 15)-1 +vals <- car.katz %>% sort(decreasing=T) +vals <- head(vals, 15) +nodes +vals +as.matrix(nodes) +as.matrix(vals) +hipaa.katz <- katz.cent(hipaa) +nodes <- hipaa.katz %>% order(decreasing=T) +nodes <- head(nodes, 15)-1 +vals <- hipaa.katz %>% sort(decreasing=T) +vals <- head(vals, 15) +as.matrix(nodes) +as.matrix(vals) +pci.katz <- katz.cent(pci) +nodes <- pci.katz %>% order(decreasing=T) +nodes <- head(nodes, 15)-1 +vals <- pci.katz %>% sort(decreasing=T) +vals <- head(vals, 15) +as.matrix(nodes) +as.matrix(vals) +car.tc.katz <- katz.cent(car.tc) +nodes <- car.tc.katz %>% order(decreasing=T) +nodes <- head(nodes, 15)-1 +vals <- car.tc.katz %>% sort(decreasing=T) +vals <- head(vals, 15) +as.matrix(nodes) +as.matrix(vals) +hipaa.tc.katz <- katz.cent(hipaa.tc) +plot(pci.dtree) +V(pci.dtree)$color <- "yellow" +plot(pci.dtree) +hipaa.tc.katz <- katz.cent(hipaa.tc) +nodes <- hipaa.tc.katz %>% order(decreasing=T) +nodes <- head(nodes, 15)-1 +vals <- hipaa.tc.katz %>% sort(decreasing=T) +vals <- head(vals, 15) +as.matrix(nodes) +as.matrix(vals) +pci.tc.katz <- katz.cent(pci.tc) +nodes <- pci.tc.katz %>% order(decreasing=T) +nodes <- head(nodes, 15)-1 +vals <- pci.tc.katz %>% sort(decreasing=T) +vals <- head(vals, 15) +as.matrix(nodes) +as.matrix(vals) +car.dtree.katz <- katz.cent(car.dtree) +nodes <- car.dtree.katz %>% order(decreasing=T) +nodes <- head(nodes, 15)-1 +vals <- car.dtree.katz %>% sort(decreasing=T) +vals <- head(vals, 15) +as.matrix(nodes) +as.matrix(vals) +hipaa.dtree.katz <- katz.cent(hipaa.dtree) +nodes <- hipaa.dtree.katz %>% order(decreasing=T) +nodes <- head(nodes, 15)-1 +vals <- hipaa.dtree.katz %>% sort(decreasing=T) +vals <- head(vals, 15) +as.matrix(nodes) +as.matrix(vals) +pci.dtree.katz <- katz.cent(pci.dtree) +nodes <- pci.dtree.katz %>% order(decreasing=T) +nodes <- head(nodes, 15)-1 +nodes <- head(nodes, 15)-1 +vals <- pci.dtree.katz %>% sort(decreasing=T) +vals <- head(vals, 15) +as.matrix(nodes) +nodes <- pci.dtree.katz %>% order(decreasing=T) +pci.dtree.katz <- katz.cent(pci.dtree) +nodes <- pci.dtree.katz %>% order(decreasing=T) +nodes <- head(nodes, 15)-1 +vals <- pci.dtree.katz %>% sort(decreasing=T) +vals <- head(vals, 15) +as.matrix(nodes) +as.matrix(vals) +plot(pci) +V(pci)$color <- "yellow" +plot(pci) +plot(pci.tc) +V(pci.tc)$color <- "yellow" +plot(pci.tc) +plot(dtree_clusters[[1,2]]) +base_clusters[[1,2]] +which(base_clusters[[1,2]] > 1) +which(base_clusters[[1,2]] > 0) +which(base_clusters[[2,2]] > 0) +which(base_clusters[[3,2]] > 0) +plot(base_clusters[[3,2]] +) +pci.dtree.deg diff --git a/Presentation/Schrick-Noah_CS-7863_Final-Presentation.odp b/Presentation/Schrick-Noah_CS-7863_Final-Presentation.odp new file mode 100644 index 0000000..8f954d3 Binary files /dev/null and b/Presentation/Schrick-Noah_CS-7863_Final-Presentation.odp differ diff --git a/Presentation/Schrick-Noah_CS-7863_Final-Presentation.pdf b/Presentation/Schrick-Noah_CS-7863_Final-Presentation.pdf new file mode 100644 index 0000000..7c447f0 Binary files /dev/null and b/Presentation/Schrick-Noah_CS-7863_Final-Presentation.pdf differ diff --git a/Presentation/Schrick-Noah_CS-7863_Final-Presentation.ppt b/Presentation/Schrick-Noah_CS-7863_Final-Presentation.ppt new file mode 100644 index 0000000..54a7456 Binary files /dev/null and b/Presentation/Schrick-Noah_CS-7863_Final-Presentation.ppt differ diff --git a/Presentation/images/APC.png b/Presentation/images/APC.png new file mode 100644 index 0000000..11a59f1 Binary files /dev/null and b/Presentation/images/APC.png differ diff --git a/Presentation/images/Betweenness.png b/Presentation/images/Betweenness.png new file mode 100644 index 0000000..ba418b6 Binary files /dev/null and b/Presentation/images/Betweenness.png differ diff --git a/Presentation/images/Car-Betwn.png b/Presentation/images/Car-Betwn.png new file mode 100644 index 0000000..c4a01e9 Binary files /dev/null and b/Presentation/images/Car-Betwn.png differ diff --git a/Presentation/images/Car-Deg.png b/Presentation/images/Car-Deg.png new file mode 100644 index 0000000..e2296af Binary files /dev/null and b/Presentation/images/Car-Deg.png differ diff --git a/Presentation/images/KPE.png b/Presentation/images/KPE.png new file mode 100644 index 0000000..0e4a4f7 Binary files /dev/null and b/Presentation/images/KPE.png differ diff --git a/Presentation/images/Katz1.png b/Presentation/images/Katz1.png new file mode 100644 index 0000000..86b18d2 Binary files /dev/null and b/Presentation/images/Katz1.png differ diff --git a/Presentation/images/Katz2.png b/Presentation/images/Katz2.png new file mode 100644 index 0000000..32a5436 Binary files /dev/null and b/Presentation/images/Katz2.png differ diff --git a/Presentation/images/Network_Table.png b/Presentation/images/Network_Table.png new file mode 100644 index 0000000..f8669d5 Binary files /dev/null and b/Presentation/images/Network_Table.png differ diff --git a/Presentation/images/PR.png b/Presentation/images/PR.png new file mode 100644 index 0000000..226955d Binary files /dev/null and b/Presentation/images/PR.png differ diff --git a/Presentation/images/PageRank.png b/Presentation/images/PageRank.png new file mode 100644 index 0000000..c5dee1d Binary files /dev/null and b/Presentation/images/PageRank.png differ diff --git a/README.md b/README.md index e69de29..86f45cd 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,9 @@ +Compliance Graph Analysis Techniques using Network Theory Approaches. + +CG_Files/ contains the network models, exploit files, dotfiles, and edge text files for each network. In addition, a manual import of the networks is given in an R script due to difficulties of variable importing of networks. + +Report/ contains various tex files used for the generation of the report. + +Presentation/ contains the various files used for the creation of the presentation. + +The main root folder contains various R files used as supporting functions for the main "Schrick-Noah_CG-Analysis.R" file. diff --git a/Submission/Schrick-Noah_CS-7863_Final-Presentation.pdf b/Submission/Schrick-Noah_CS-7863_Final-Presentation.pdf new file mode 100644 index 0000000..7c447f0 Binary files /dev/null and b/Submission/Schrick-Noah_CS-7863_Final-Presentation.pdf differ diff --git a/Submission/Schrick-Noah_CS-7863_Final-Presentation.ppt b/Submission/Schrick-Noah_CS-7863_Final-Presentation.ppt new file mode 100644 index 0000000..54a7456 Binary files /dev/null and b/Submission/Schrick-Noah_CS-7863_Final-Presentation.ppt differ diff --git a/Submission/Schrick-Noah_CS-7863_Final-Report.pdf b/Submission/Schrick-Noah_CS-7863_Final-Report.pdf new file mode 100644 index 0000000..4a929ca Binary files /dev/null and b/Submission/Schrick-Noah_CS-7863_Final-Report.pdf differ