#' Provide a summary table with network attributes
#'
#' This funtion provides a table contaning various network attributes
#' @param graph.object is a graph object that is used for plotting in an igraph
#' @param node: total number of nodes in the given graph object
#' @param edge: total number of links in the given graph object
#' @param nodeDegree: node degree
#' @param avgpath: average path length
#' @param trans: transitivity
#' @param mod: modularity, detected based on walktrap.community algorithm
#' @param connectance: connectance
#' @param wtc: number of modules based on walktrap.community algorithm
#' @param nModules.SA: number of modules based on SA algorithm implemented under rnercarto package
#' @param top3hub: top3 hub node
#' @param top3hubv: top3 hub node value
#' @param n_postiveL: number of positive links
#' @param n_negativeL: number of negative links
#' @keywords igraph, summary, graph
#' @export
#' @examples
#' g <- erdos.renyi.game(100, 1/1000)
#' analyse_graph <- summary.graph(g)
summary.graph <- function (graph.object){
adjm <- as.matrix(get.adjacency(graph.object))
adjm[lower.tri(adjm)]=0
role1<-netcarto(adjm)
role2<-role1[[1]]
nModules.SA <- length(unique(role2$module))
edge<-ecount(graph.object)
node<-vcount(graph.object)
nodeDegree<-round((edge/node),3)
connectance<-round((edge/(node^2)),3)
avgpath <- round(average.path.length(graph.object),3)
trans <- round(transitivity(graph.object, type = c("average")),3)
wtc<-max((walktrap.community(graph.object))$membership) # gives lot of useful infromation, but lets grab only the number of modules
mod <- round(modularity(walktrap.community(graph.object)),3)
top3hub<-top3Hub(graph.object)[1]
top3hubv<-top3Hub(graph.object)[2]
n_postiveL <- sum((E(graph.object)$weight > 0 ) * 1)
n_negativeL <- sum((E(graph.object)$weight < 0 ) * 1)
tabular <- data.frame(node,edge,nodeDegree,avgpath, trans, mod,connectance,wtc,nModules.SA,top3hub,top3hubv, n_postiveL, n_negativeL)
return(tabular)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.