Description Usage Arguments Value Examples
View source: R/MDMAnalyzer_v0.R
Calculate degree, betweenness, and closeness scores for each node in network (igraph) and store results in dataframe. Nodes are represented by row. Each column represents a separate network centrality measure.
1 | degree_calc_f(orig_graph)
|
orig_graph |
Graph object of taxa co-occurrence relationships |
Returns dataframe of degree, betweenness, and closeness scores for all nodes in network
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (orig_graph)
{
degree_df <- as.data.frame(igraph::degree(orig_graph))
degree_df$names <- rownames(degree_df)
colnames(degree_df)[1] = "degree"
degree_df$bw <- as.vector(igraph::betweenness(orig_graph))
degree_df$closeness <- as.vector(igraph::closeness(orig_graph))
print(head(degree_df))
return(degree_df)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.