top3Hub <- function(graph.object){ aa <- authority.score(graph.object)$vector bb <- V(graph.object) dd <- list(bb,round(aa,3)) df <- data.frame(matrix(unlist(dd), nrow=length(V(graph.object)), byrow=F)) ordf <- df[with(df, order(-df[,2])), ] Hub <- ordf[1:3,1] grabHub <- paste(Hub,collapse=";") HUbV <- ordf[1:3,2] grabHubV <- paste(HUbV,collapse=";") grab <- c(grabHub,grabHubV) return(grab) }
library(devtools) install_github("ravinpoudel/myFunctions") library(myFunctions) library(igraph)
g <- erdos.renyi.game(10, 1/5) top3 <- top3Hub(g) top3 plot(g)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.