Description Usage Arguments Value Examples
This function takes a very connected network graph and prunes the edges down
so that it focuses on depth from the root node to the end nodes (inter-connective
edges are deleted).
1. Find all nodes 1 step out from root. These edges must stay.
2. Find all nodes 2 steps from root that have more than 2 edges in.
Keep only one edge (the one that leads to the shortest path back to the root).
3. Repeat for the nodes one more degree away from root.
1 | pruneEdge(g, root)
|
g |
igraph object |
root |
character string: name of root node |
igraph object, pruned subgragh of g
1 2 3 4 5 6 7 8 9 10 11 | require('igraph')
## build sample network
from <- c('A','A','B','B','C','C','D','D','E','E','E','F','F','H','L','L','O')
to <- c('B','C','D','E','F','G','H','I','J','J','K','L','G','M','N','O','P')
relations<-cbind(from,to)
g <- graph.data.frame(relations)
tiers <- c(1,2,3,4,1,3,4,2,1,2,3,4,0,0,1,2)
V(g)$tier <- tiers
prungeEdge(g, 'A')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.