R/004_top3hub.R

Defines functions top3Hub

Documented in top3Hub

#' Provide top three hub node and assocaited hub value from a give graph object.
#'
#' This funtion provides a table contaning various network attributes
#' @param graph.object is a graph object that is used for plotting in an igraph
#' @keywords igraph, summary, graph, top3hub
#' @export
#' @examples
#' g <- erdos.renyi.game(100, 1/1000)
#' top3<- top3Hub(g)


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)

}
ravinpoudel/myFunctions documentation built on May 9, 2020, 7:39 a.m.