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

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

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

                                        EXPERIMENTAL class "graphBAM"
                                         实验班“graphBAM”

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

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

The graphBAM class represents a graph as an adjacency matrix.  The adjacency matrix is stored as a bit array using a raw vector to reduce the memory footprint and speed operations like graphIntersection.  This class is EXPERIMENTAL and its API is subject to change.
graphBAM类代表邻接矩阵图。有点像rawgraphIntersection向量,以减少内存占用和速度操作数组作为邻接矩阵存储。这个类是实验性的,它的API是受改变。


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


graphBAM(df, nodes=NULL, edgemode="undirected", ignore_dup_edges = FALSE)



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

参数:df
A data.frame with three columns: "from", "to" and "weight". Columns "from" and "to" can be either factors or character vectors.  Each row of df describes an edge in the resulting graph.  The "weight" column must be numeric.  
一个data.frame有三列:“从”,“来”和“重量”。列“,从”和“到”可以是因素或特征向量。每行df描述了在图的边缘。 “重量”一栏必须是数字。


参数:nodes
A character vector of node labels.  Use this to add degree zero nodes to the graph.  If NULL, the set of nodes found in from and to will be used.  
一个节点标签的特征向量。使用这个添加零度节点的图形。如果NULL,from和to将被用来发现节点集。


参数:edgemode
A string, one of "directed" or "undirected".  
一个字符串,“定向”或“无向”之一。


参数:ignore_dup_edges
If FALSE (default), specifying duplicate edges in the input is an error.  When set to TRUE duplicate edges are ignored. Edge weight values are ignored when determining duplicates.  This is most useful for graph import and conversion.  
如果FALSE(默认),在输入指定的重复边缘是一个错误。设置TRUE时被忽略重复的边缘。确定重复时,边的权值将被忽略。这是最有用的图形导入和转换。


构造----------Constructors----------

The GraphBAM function is used to create new graphBAM instances.  Edges are specified in a data.frame.  For undirected graphs, reciprical edges should not be includes unless ignoe_dup_edges is TRUE.
GraphBAM函数用于创建新的graphBAM实例。边指定在data.frame。对于无向图,reciprical边缘不应被包括ignoe_dup_edges除非是TRUE。


延伸----------Extends----------

Class "graph", directly.
类"graph",直接。


graphBAM对象的方法----------Methods for graphBAM objects----------

Return a new graphBAM object with the specified edge(s) added.  The from and to arguments must either be the same length or one of them must be of length one.  Each time an edge is added, the entire graph is copied.  For the purpose of building a graph it will often be more efficient to build up the list of edges and call GraphBAM.
返回指定的边缘(S)的一个新的graphBAM对象。 from和to参数必须是相同的长度,或其中一人必须是一个长度。每添加一个边缘的时候,整个图形被复制。为建立一个图,它往往会变得更有效率,建立边的列表,并调用GraphBAM的目的。

Return a new graphBAM object with the specified node(s) added.
返回与指定的节点(S)的一个新的graphBAM对象。

This operation is not currently supported.
目前不支持此操作。

Returns an adjacency list representation of the graph.  The list will have an entry for each node with a vector of adjacent node labels or character(0).  For undirected graphs, edges returns the reciprocal edges.  The optional argument which can be a character vector of node labels. When present, only entries for the specified nodes will be returned.
返回图的邻接表表示。这份名单将与相邻节点标签或character(0)向量每个节点的条目。对于无向图,edges返回互惠的边缘。可选的参数which可以是一个节点标签的特征向量。目前,唯一指定节点的条目将被退回。

(Not yet supported) Similar to the edges function, but the adjacency list maps nodes that have an edge to the given node instead of from the given node.
(目前尚不支持)类似edges功能,但邻接表图的节点,有一个给定的节点,而不是从给定的节点的边缘。

Returns a logical vector indicating whether there is an edge corresponding to the elements in from and to.  These vectors must have the same length, unless one has length one.
返回一个逻辑向量,说明是否有边缘对应from和to的元素的。这些向量必须具有相同的长度,除非有一个长度。

Return the node labels for the graph
返回该图的节点标签

Returns the number of edges in the graph.
返回图中的边数。

Returns the number of nodes in the graph
返回图中的节点数量。

Return a new graphBAM object with the specified edges removed.  The from and to arguments must be the same length unless one of them has length one.
删除指定的边缘,返回一个新的graphBAM对象。 from和to参数必须是相同的长度,除非其中一人有一个长度。

Returns a new graphBAM object with the specified node removed. Node and edge attributes corresponding to that node are also removed.
删除指定节点返回一个新的graphBAM对象。该节点对应的节点和边的属性也将被删除。

Access edge attributes.  See help for edgeData.
接入边缘属性。请参阅帮助edgeData。

Access edge data default attributes .
接入边缘数据的默认属性。

Access node data default attributes .
访问节点数据的默认属性。

Return the edge weights for the graph in adjacency list format. The optional argument index specified a character vector of nodes.  In this case, only the weights for the specified nodes will be returned.
返回邻接表格式的图形的边权重。可选的参数index指定一个节点的特征向量。在这种情况下,只有指定节点的权重将被退回。

Returns a data frame with column names "from", "to", and "weight" corresponding to the connected nodes in the graphBAM object.
返回列名的数据“帧”,“到”,和“重量”对应在graphBAM对象连接的节点。

When given two graphBAM objects, graphIntersect returns a new graphBAM containing the nodes and edges in common between the two graphs.  Both x and y should either be  directed or undirected. The intersection is computed by first finding the intersection of the node sets, obtaining the resulting subgraphs, and finding the intersection of the resulting edge sets. Node/Edge attributes that are equal are carried over to the result. Non equal edge/node attributes will result in the  corresponding attribute being set to NA. The user has the option  of providing a named list of functions correspoding to the names of  the edge attributes for resolving conflicting edge attributes.  For resolving any of the conflicting node attributes the user has the option of providing a named list of functions corresponding to the node attribute names.
当给定的两个graphBAM对象,graphIntersect返回一个新的graphBAM包含两个图形之间的共同节点和边缘。 x和y都应该向或无向。路口的计算方法是先找到节点集的交集,获得由此产生的子图,并寻找产生的边缘集的交集。节点/边缘属性,都是平等的,结转到结果。非平等的边缘/节点的属性将导致相应的属性被设置为NA。用户提供的功能correspoding来解决冲突的边缘属性边缘属性的名称命名的选项。解决任何冲突的节点属性的用户提供一个名为list节点的属性名对应的功能选项。

When given two graphBAM objects, graphUnion returns a new graphBAM containing the union of nodes and  edges between the two graphs. The union is compted by first finding the union of the nodesets. Both x and y should be either directed or  undirected. Node/Edge attributes that are equal are carried over to the result. Non equal edge/node attributes will result in the  corresponding attribute being set to NA. The user has the option  of providing a named list of functions correspoding to the names of  the edge attributes for resolving conflicting edge attributes.  For resolving any of the conflicting node attributes the user has the option of providing a named list of functions corresponding to the node attribute names.
当两个graphBAM对象,graphUnion返回一个新的graphBAM含有工会节点和两个图形之间的边缘。工会compted首先找到工会的节点集。 x和y都应该向或无向。节点/边缘属性,都是平等的,结转到结果。非平等的边缘/节点的属性将导致相应的属性被设置为NA。用户提供的功能correspoding来解决冲突的边缘属性边缘属性的名称命名的选项。解决任何冲突的节点属性的用户提供一个名为list节点的属性名对应的功能选项。

Set the edgemode for the graph ("directed" or "undirected").  If the specified edgemode is the same, the object is returned without changes.  Otherwise, a directed graph is converted to an undirected graph via ugraph and an undirected graph is returned such that each edge is interpreted as two edges, one in each direction.
设置图edgemode(“指示”或“无向”)。如果指定的edgemode是相同的,则返回该对象没有改变。否则,一个有向图转换为无向图通过ugraph返回一个无向图等,每边解释为两个边,在每个方向之一。

Return an undirected version of the current graph.  Conceptually, the arrows of a graph's directed edges are removed.
返回当前图形的无向版本。从概念上讲,一个图的有向边的箭头将被删除。

Replacement of a graphBAM object's node labels is currently not supported.  An error is raised if this method is called.
目前不支持更换graphBAM对象的节点标签。如果这种方法被称为将引发错误。


强迫----------Coercion----------

graphBAM objects can be coerced to graphAM, graphNEL, and matrix instances via as(g, CLASS).
graphBAM对象可以强制通过graphAMgraphNEL,matrix,as(g, CLASS)实例。


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


N. Gopalakrishnan, S. Falcon



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


    f <- c("a", "a", "b", "c", "d")
    t <- c("b", "c", "c", "d", "a")
    weight <- c(2.3, 2.3, 4.3, 1.0, 3.0)
    df <- data.frame(from=f, to=t, weight= weight)
    g <- graphBAM(df)
    nd <- nodes(g)
    nodeDataDefaults(g, attr ="color") <- "green"
    nodeData(g,n=c("b", "c"), attr ="color") <- "red"
    w1 <- edgeWeights(g)
    w2 <- edgeWeights(g,"a")
    w3 <- edgeWeights(g,1)
    d1 <- edges(g)
    d2 <- edges(g,c("a", "b"))
    e1 <- edgeData(g)   
    e2 <- edgeData(g, "a", "c",attr="weight")
    em <- edgeMatrix(g)
    id <- isDirected(g)
    sg <- subGraph(c("a","c","d"), g)
    ft <- extractFromTo(g)
    am <- as(g,"graphAM")
    nl <- as(g,"graphNEL")
    mt <- as(g,"matrix")
    k  <- graphIntersect(g,g)
    k <- graphUnion(g,g)
    e <- removeEdgesByWeight(g,lessThan= 3.0)
    f <- removeNode("a", g)
    g

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-2-6 15:03 , Processed in 0.024328 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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