Description Usage Arguments Examples
View source: R/bowtie_functions.R
Calculate the weighted topological overlap for all nodes in a network
1 | wTO_network(igraph_object, node_vector, thread_numb = 1)
|
igraph_object |
An igraph network object |
node_vector |
Vector with the names of all the nodes in the network |
thread_numb |
The number of threads to use |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # Create graph
random_graph = sample_pa(n=200, power = 1.2, directed=F)
E(random_graph)$weight = runif(n=length(E(random_graph)))
# Calculate wTO
wTO_list = bowtie::wTO.network(node_vector = as.vector(V(random_graph)), igraph_object = random_graph, thread_numb = 4)
wTO_matrix = bowtie::from.list.to.df(wTO_list)
# Ordering of nodes
hclust_object = hclust(as.dist(1-wTO_matrix), method = 'average')
node_order = hclust_object$labels[hclust_object$order]
# Visualize
image(wTO_matrix[node_order,node_order], useRaster = T, col = colorRampPalette(brewer.pal(9,"YlGnBu"))(49))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.