combineNodes(graph)
combineNodes()所属R语言包:graph
combineNodes
combineNodes
译者:生物统计家园网 机器人LoveR
描述----------Description----------
A function to combine, or collapse, a specified set of nodes in a graph.
函数相结合,或崩溃,在图中的节点指定的一组。
用法----------Usage----------
combineNodes(nodes, graph, newName, ...)
## S4 method for signature 'character,graphNEL,character'
combineNodes(nodes, graph, newName, collapseFunction=sum)
参数----------Arguments----------
参数:nodes
A set of nodes that are to be collapsed.
一组是被倒塌的节点。
参数:graph
The graph containing the nodes
包含节点的图
参数:newName
The name for the new, collapsed node.
新的名称,倒塌的节点。
参数:collapseFunction
Function or character giving the name of a function used to collapse the edge weights after combining nodes. The default is to sum up the weights, but mean would be a useful alternative.
函数或字符用于崩溃后,结合节点的边权重函数的名称。默认是总结的重量,但平均将是一种有益的替代。
参数:...
Additional arguments for the generic
通用的附加参数
Details
详情----------Details----------
The nodes specified are reduced to a single new node with label given by newName. The in and out edges of the set of nodes are all made into in and out edges for the new node.
指定的节点减少到一个带标签的新节点newName。和节点集的边都做成和新节点的边。
值----------Value----------
An new instance of a graph of the same class as graph is returned. This new graph has the specified nodes reduced to a single node.
一个graph同一类图的一个新实例被返回。这种新的图有指定的节点减少到一个单一的节点。
作者(S)----------Author(s)----------
R. Gentleman
参见----------See Also----------
inEdges, addNode
inEdges,addNode
举例----------Examples----------
V <- LETTERS[1:4]
edL1 <- vector("list", length=4)
names(edL1) <- V
for(i in 1:4)
edL1[[i]] <- list(edges=c(2,1,4,3)[i], weights=sqrt(i))
gR <- new("graphNEL", nodes=V, edgeL=edL1, edgemode="directed")
gR <- addNode("M", gR)
gR <- addEdge("M", "A", gR, 1)
gR <- addEdge("B", "D", gR, 1)
gX <- combineNodes(c("B","D"), gR, "X")
gR <- addNode("K", gR)
gR <- addEdge(c("K","K"), c("D", "B"), gR, c(5,3))
edgeWeights(combineNodes(c("B","D"), gR, "X"))$K
edgeWeights(combineNodes(c("B","D"), gR, "X", mean))$K
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|