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

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

[复制链接]
发表于 2012-9-27 19:25:33 | 显示全部楼层 |阅读模式
newgraph(RnavGraph)
newgraph()所属R语言包:RnavGraph

                                         Create a graph object of class graph
                                         创建一个图形对象的类图

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

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

Create a graph object of class graphNEL or graphAM. You might also use the graph creating facility provided by the graph package.
创建图形对象类别graphNEL或graphAM。您还可以使用的图表创建提供graph包。


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


newgraph(nodeNames, mat, weights = NULL, directed = FALSE, isAdjacency = FALSE, ...)



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

参数:nodeNames
Numeric or character string vector.  
数字或字符串向量。


参数:mat
Either an adjacency matrix or a from to matrix.  
无论是邻接矩阵或以矩阵。


参数:weights
Numeric weights for edges. Either in the same order as the from to matrix or as a square matrix, depending what one have chosen for the mat argument.  
数字边的权重。无论是在相同的顺序从矩阵或作为一个方阵,这取决于人们已选择mat参数。


参数:directed
Logical value for defining a directed or undirected graph.  
定义有向或无向图的逻辑值。


参数:isAdjacency
If argument mat is adjacency matrix.  
如果参数垫是邻接矩阵。


参数:...
Currently not needed.  
目前没有必要的。


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

graphNEL or grapAM object.
graphNEL或grapAM对象。


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



Adrian Waddell and R. Wayne Oldford




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

navGraph, completegraph, linegraph
navGraph,completegraph,linegraph


实例----------Examples----------


## Using from to matrices[#使用矩阵]
from <- c("A","A","C","C")
to   <- c("B","C","B","D")
ftEmat <- cbind(from,to)

## note how the E node is added[#注意添加的E节点]
G <- newgraph(nodeNames = LETTERS[1:5], mat = ftEmat)

## say you would like to add weights to the graph[#说你想添加到图形中的权重]
weights <- c(2,1,3,4)
G <- newgraph(nodeNames = LETTERS[1:5], mat = ftEmat, weights = weights)

## newgraph with adjacency matrix[#newgraph用邻接矩阵]
V <- c('s.L', 's.W', 'p.L', 'p.W')
adjM <- matrix(c(0,1,1,0,1,0,1,1,1,1,0,0,0,1,0,0), ncol = 4)
all(adjM == t(adjM)) ## is symmetric (undirected)[#是对称的(无向)]
G <- newgraph(nodeNames = V, mat= adjM, isAdjacency=TRUE)

## if you use adjacency matrices, you can add a matrix with weights[#如果你使用邻接矩阵,你可以添加一个权重矩阵]
adjM <-     matrix(c(0,0,1,0,1,0,1,1,0,0,0,0,0,1,0,0), ncol = 4)
weightsM <- matrix(c(0,0,5,0,2,0,1,3,0,0,0,0,0,7,0,0), ncol = 4)
G <- newgraph(nodeNames = V, mat= adjM, weights = weightsM, directed = TRUE, isAdjacency=TRUE)
edgeData(G, attr = "weight")

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-11-24 14:01 , Processed in 0.024872 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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