Description Usage Arguments Examples
View source: R/bowtie_functions.R
Calculate the weighted topological overlap (wTO) between two nodes in an iGraph network
1 | wTO_two_nodes(igraph_obj, node1_id, node2_id, node_vector, neighbour_list)
|
igraph_obj |
An igraph network object |
node1_id |
The name of the first node |
node2_id |
The name of the second node |
node_vector |
Vector with the names of all the nodes in the network |
neighbour_list |
A list containing the neighbor nodes of each node |
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.