找回密码
 注册
查看: 1921|回复: 0

R语言 graph包 edgeWeights()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-2-25 21:08:25 | 显示全部楼层 |阅读模式
edgeWeights(graph)
edgeWeights()所属R语言包:graph

                                        Retrieve the edge weights of a graph
                                         检索图形的边权重

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

A generic function that returns the edge weights of a graph.  If index is specified, only the weights for the edges from the specified nodes are returned.  The user can control which edge attribute is interpreted as the weight, see the Details section.
一个泛型函数返回一个图的边权重。如果index指定,只有从指定节点的边的权重返回。用户可以控制边缘属性被解释为体重,看到细节部分。


用法----------Usage----------


edgeWeights(object, index, ..., attr = "weight", default = 1, type.checker = is.numeric)



参数----------Arguments----------

参数:object
A graph, any object that inherits from the graph class.  
一个图任何graph类继承的对象。


参数:index
If supplied, a character or numeric vector of node names or indices.
如果提供的节点名称或指数的字符或数字向量。


参数:...
Unused.
未使用。


参数:attr
The name of the edge attribute to use as a weight.  You can view the list of defined edge attributes and their default values using edgeDataDefaults.  The default attribute name is "weight", see the Details section.
name属性的边缘使用重量。您可以查看列表中定义的边缘属性和使用它们的默认值edgeDataDefaults。默认属性的名称是"weight",看到细节部分。


参数:default
The value to use if object has no edge attribute named by the value of attr.  The default is the value 1 (double).
要使用的值,如果object有没有边缘属性由attr值命名。默认值为1(双)。


参数:type.checker
A function that will be used to check that the edge weights are of the correct type.  This function should return TRUE if the input vector is of the right type and FALSE otherwise. The default is to check for numeric edge weights using is.numeric.  If no type checking is desired, specify NULL.
一个将被用来检查,边权是正确的类型的功能。这个函数应该返回TRUE,如果输入向量是正确的类型,否则返回FALSE。默认是检查数字边缘使用is.numeric权。如果没有类型检查的需要,指定NULL。


Details

详情----------Details----------

If index is suppled, then edge weights from these nodes to all adjacent nodes are returned. If index is not supplied, then the edge weights for all nodes are returned.  The value for nodes without any outgoing edges will be a zero-length vector of the appropriate mode.
index如果是suppled,然后从这些节点的所有相邻节点的边权被返回。 index如果不提供的,然后返回所有节点的边权重。没有任何向外的边缘节点的值将是一个适当的模式长度为零的向量。

The edgeWeights method is a convenience wrapper around edgeData, the general-purpose way to access edge attribute information for a graph instance.  In general, edge attributes can be arbitary R objects.  However, for edgeWeights to make sense, the values must be vectors of length not more than one.
edgeWeights方法是方便周围edgeData包装,通用的方式来访问边缘为graph实例的属性信息。一般边缘属性可以是arbitary的的R对象。然而,edgeWeights感,值必须是长度不超过一向量。

By default, edgeWeights looks for an edge attribute with name "weight" and, if found, uses these values to construct the edge weight list.  You can make use of attributes stored under a different name by providing a value for the attr argument.  For example, if object is a graph instance with an edge attribute named "WTS", then the call edgeWeights(object, attr="WTS") will attempt to use those values.
默认情况下,edgeWeights边缘属性看起来与名称"weight"“,如果发现,使用这些值构造边缘重量列表。您可以使用提供一个attr参数值根据不同的名称存储的属性。例如,如果object是一个边缘命名属性图实例"WTS",然后调用edgeWeights(object, attr="WTS")将尝试使用这些值。

The function specified by type.checker will be given a vector of edge weights; if the return value is not TRUE, then an error will be signaled indicating that the edge weights in the graph are not of the expected type.  Type checking is skipped if type.checker is NULL.
type.checker指定的功能得到了边权重向量;如果返回值不是TRUE,那么错误将信号表示图中的边权重是不是预期的类型。 type.checker如果是NULL跳过类型检查。

If the graph instance does not have an edge attribute with name given by the value of the attr argument, default will be used as the weight for all edges.  Note that if there is an attribute named by attr, then its default value will be used for edges not specifically customized.  See edgeData and edgeDataDefaults for more information.
如果图实例没有边缘属性与由attr参数值给定的名称,default将用作所有边缘的重量。请注意,如果有一个名为attr属性,那么它的默认值将没有专门定制的边缘。看到edgeData和edgeDataDefaults更多信息。

Because of their position after the ..., no partial matching is performed for the arguments attr, default, and type.checker.  
因为他们的位置后...,无偏参数进行匹配attr,default和type.checker。


值----------Value----------

A named list of named edge weight vectors. The names on the list are the names of the nodes specified by index, or all nodes if index was not provided.  The names on the weight vectors are node names to identify the edge to which the weight belongs.
一个名为边的权重向量的命名列表。名单上的名字是index如果index未提供的所有节点指定的节点的名称。权重向量的名称,以确定它的重量属于边缘的节点名称。


作者(S)----------Author(s)----------


R. Gentleman and S. Falcon



参见----------See Also----------

nodes edges edgeData edgeDataDefaults is.numeric is.integer is.character
nodesedgesedgeDataedgeDataDefaultsis.numericis.integeris.character


举例----------Examples----------


  V <- LETTERS[1:4]
  edL2 <- vector("list", length=4)
  names(edL2) <- V
  for(i in 1:4)
    edL2[[i]] <- list(edges=c(2,1,2,1)[i], weights=sqrt(i))
  gR2 <- new("graphNEL", nodes=V, edgeL=edL2, edgemode="directed")
  edgeWeights(gR2, "C")
  edgeWeights(gR2)
  edgeWeights(gR2, attr="foo", default=5)
  edgeData(gR2, attr="weight")
  edgeData(gR2, from="C", attr="weight")

转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2025-2-6 15:05 , Processed in 0.048516 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表