Description Usage Arguments Value Author(s) See Also Examples
Rename the nodes of a graphNEL
object according to a character
vector named by current node names with elements indicating the new node names. Duplicates are
summarized to be a single node containing all edges and indicated by the maximum edge weights
1 | collapse.nodes.genes(targ.graph, node.names)
|
targ.graph |
A |
node.names |
A named |
A graphNEL
object.
Daniel Bottomly
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | set.seed(123)
rand.graph <- randomGraph(V=sample(colors()[1:10]), M=1:4, p=.4)
node.vec <- nodes(rand.graph)
names(node.vec) <- node.vec
node.vec[sample.int(length(node.vec), 3)] <- "hello"
new.graph <- collapse.nodes.genes(rand.graph, node.vec)
edgeWeights(new.graph)["hello"]
edgeWeights(rand.graph)[names(node.vec)[node.vec == "hello"]]
if (require(Rgraphviz))
{
par(mfcol=c(2,1))
plot(rand.graph)
plot(new.graph)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.