randomGraph(graph)
randomGraph()所属R语言包:graph
Random Graph
随机图
译者:生物统计家园网 机器人LoveR
描述----------Description----------
This function generates a random graph according to a model that involves a latent variable. The construction is to randomly assign members of the set M to the nodes, V. An edge is assigned between two elements of V when they both have the same element of M assigned to them. An object of class graphNEL is returned.
这个函数生成一个随机的图形,根据涉及潜变量模型。建设是随机分配集M节点,V成员。一个边两个元素之间的分配V时,它们都具有相同的元素M分配给他们。 graphNEL类的对象被返回。
用法----------Usage----------
randomGraph(V, M, p, weights=TRUE)
参数----------Arguments----------
参数:V
The nodes of the graph.
图中的节点。
参数:M
A set of values used to generate the graph.
一组值用于生成图。
参数:p
A value between 0 and 1 that indicates the probability of selecting an element of M
0和1之间的一个值,表示的概率的选择M的元素
参数:weights
A logical indicating whether to use the number of shared elements of M as weights.
一个逻辑指示是否使用M作为权数,共享的元素的数量。
Details
详情----------Details----------
The model is quite simple. To generate a graph, G, the user supplies the list of nodes, V and a set of values M which will be used to create the graph. For each node in V a logical vector with length equal to the length of M is generated. The probability of a TRUE at any position is determined by p. Once valus from M have been assigned to each node in V the result is processed into a graph. This is done by creating an edge between any two elements of V that share an element of M (as chosen by the selection process).
该模型是相当简单的。要生成一个图表,G,用户提供的节点列表,V和M将用于创建图表的值。对于每个节点V一个逻辑向量的长度等于M产生的长度。一个TRUE在任何位置的概率确定p。一旦价值观的从M已分配给每个节点V图形处理结果。这是通过创建一个任何两个元素之间的边缘做V共享一个元素M(选择过程中选择)。
The sizes of V and M and the values of p determine how dense the graph will be.
尺寸V和M和p确定图将如何密集的价值观。
值----------Value----------
An object of class graphNEL-class is returned.
graphNEL-class类的对象被返回。
作者(S)----------Author(s)----------
R. Gentleman
参见----------See Also----------
randomEGraph, randomNodeGraph
randomEGraph,randomNodeGraph
举例----------Examples----------
set.seed(123)
V <- letters[1:10]
M <- 1:4
g1 <- randomGraph(V, M, 0.2)
numEdges(g1) # 16, in this case[16,在这种情况下,]
edgeNames(g1)# "<from> ~ <to>" since undirected[因为无向的“<from>~<to>”]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|