component.dist(sna)
component.dist()所属R语言包:sna
Calculate the Component Size Distribution of a Graph
计算组件的大小分布图的
译者:生物统计家园网 机器人LoveR
描述----------Description----------
component.dist returns a list containing a vector of length n such that the ith element contains the number of components of graph G having size i, and a vector of length n giving component membership (where n is the graph order). Component strength is determined by the connected parameter; see below for details.
component.dist返回,使得nth元素包含图形的数目的组件的列表中包含的矢量的长度iG具有大小i,和一个向量的长度n组件的成员(其中n是图顺序)。组件的强度是由connected参数,详情见下文。
component.largest identifies the component(s) of maximum order within graph G. It returns either a logical vector indicating membership in a maximum component or the adjacency matrix of the subgraph of G induced by the maximum component(s), as determined by result. Component strength is determined as per component.dist.
component.largest识别组件(s)的最大订单内图形G。它返回一个logical矢量成员的最大组件的子图的邻接矩阵的G诱导的最大组成部分(S),作为决定result。组件的强度是每component.dist。
用法----------Usage----------
component.dist(dat, connected=c("strong","weak","unilateral",
"recursive"))
component.largest(dat, connected=c("strong","weak","unilateral",
"recursive"), result = c("membership", "graph"))
参数----------Arguments----------
参数:dat
one or more input graphs.
一个或多个输入图表。
参数:connected
a string selecting strong, weak, unilateral or recursively connected components; by default, "strong" components are used.
一个字符串选择的强,弱,单方面或循环连接的组件,默认情况下,"strong"组件。
参数:result
a string indicating whether a vector of membership indicators or the induced subgraph of the component should be returned.
一个字符串,指示是否应该返回一个向量的的会员指标或诱导子的组件。
Details
详细信息----------Details----------
Components are maximal sets of mutually connected vertices; depending on the definition of “connected” one employs, one can arrive at several types of components. Those supported here are as follows (in increasing order of restrictiveness):
组件是相互连接的顶点的最大套;取决于1采用的“连接”的定义中,一个可以到达在几种类型的组件。这里支持如下(限制性递增的顺序):
<ol> weak: v_1 is connected to v_2 iff there exists a semi-path from v_1 to v_2 (i.e., a path in the weakly symmetrized graph)
<OL>weak:v_1连接到v_2当且仅当存在一个半路径v_1到v_2(即路径中的弱对称图)
unilateral: v_1 is connected to v_2 iff there exists a directed path from v_1 to v_2 or a directed path from v_2 to v_1
unilateral:v_1连接到v_2当且仅当存在一个路径v_1到v_2或直接路径v_2到 X>
strong: v_1 is connected to v_2 iff there exists a directed path from v_1 to v_2 and a directed path from v_2 to v_1
strong:v_1连接到v_2当且仅当存在一个路径v_1到v_2和定向的路径v_2到 X>
recursive: v_1 is connected to v_2 iff there exists a vertex sequence v_a,...,v_z such that v_1,v_a,...,v_z,v_2 and v_2,v_z,...,v_a,v_1 are directed paths </ol>
recursive:v_1连接v_2当且仅当存在一个顶点序列v_a,...,v_z等v_1,v_a,...,v_z,v_2和v_2,v_z,...,v_a,v_1导演的路径</ OL>
Note that the above definitions are distinct for directed graphs only; if dat is symmetric, then the connected parameter has no effect.
请注意,上述的定义是不同的仅对于有向图;如果dat是对称的,那么connected参数具有任何效果。
值----------Value----------
For component.dist, a list containing:
component.dist,一个列表,其中包含:
<table summary="R valueblock"> <tr valign="top"><td>membership </td> <td> A vector of component memberships, by vertex</td></tr> <tr valign="top"><td>csize</td> <td> A vector of component sizes, by component</td></tr> <tr valign="top"><td>cdist</td> <td> A vector of length |V(G)| with the (unnormalized) empirical distribution function of component sizes</td></tr>
<table summary="R valueblock"> <tr valign="top"> <TD> membership </ TD> <td>一个向量的组成部分成员资格,由顶点</ TD> </ TR> <TR VALIGN =“”> <TD>csize </ TD> <TD>的矢量元件尺寸,元件</ TD> </ TR> <tr valign="top"> <TD> X> </ TD> <td>一个矢量的长度| V(G)|(非标准化)的经验分布函数的元件尺寸</ TD> </ TR>
</table> If multiple input graphs are given, the return value is a list of lists.
</ TABLE>如果有多个输入图中,返回值是一个列表的列表。
For component.largest, either a logical vector of component membership indicators or the adjacency matrix of the subgraph induced by the largest component(s) is returned. If multiple graphs were given as input, a list of results is returned.
对于component.largest,无论是logical向量的组成部分会员的指标或诱导子图的邻接矩阵的最大组成部分(S),则返回。如果有多个图形作为输入,返回一个结果列表。
注意----------Note----------
Unilaterally connected component partitions may not be well-defined, since it is possible for a given vertex to be unilaterally connected to two vertices which are not unilaterally connected with one another. Consider, for instance, the graph a->b<-c<-d. In this case, the maximal unilateral components are ab and bcd, with vertex b properly belonging to both components. For such graphs, a unique partition of vertices by component does not exist, and we “solve” the problem by allocating each “problem vertex” to one of its components on an essentially arbitrary basis. (component.dist generates a warning when this occurs.) It is recommended that the unilateral option be avoided where possible.
单方面连接组件分区可能无法很好定义的,因为它有可能为一个给定的顶点单方面要连接到的两个顶点不能单方面彼此连接。考虑,例如,图形a->b<-c<-d。在这种情况下,最大的单方面组件ab和bcd,与顶点b属于这两个组件正确。对于这样的图的顶点的组成部分,一个独特的分区不存在,我们“解决”的问题,基本上是武断的基础上分配给“的问题顶点”,它的组件之一。 (component.dist产生一个警告,当发生这种情况)。unilateral选项建议在可能的情况下避免。
Do not make the mistake of assuming that the subgraphs returned by component.largest are necessarily connected. This is usually the case, but depends upon the uniqueness of the largest component.
不要犯这样的错误的假设返回的子图component.largest一定连接。这是通常的情况下,但取决于的最大组成部分的独特性。
(作者)----------Author(s)----------
Carter T. Butts <a href="mailto:buttsc@uci.edu">buttsc@uci.edu</a>
参考文献----------References----------
<h3>See Also</h3>
实例----------Examples----------
g<-rgraph(20,tprob=0.06) #Generate a sparse random graph[随机生成一个稀疏图]
#Find weak components[查找薄弱的组件]
cd<-component.dist(g,connected="weak")
cd$membership #Who's in what component?[谁在什么成分?]
cd$csize #What are the component sizes?[组件的大小是什么?]
#Plot the size distribution[绘制的尺寸分布]
plot(1:length(cd$cdist),cd$cdist/sum(cd$cdist),ylim=c(0,1),type="h")
lgc<-component.largest(g,connected="weak") #Get largest component[最大的组成部分]
gplot(g,vertex.col=2+lgc) #Plot g, with component membership[图克,组件的成员]
#Plot largest component itself [图最大的组成部分本身]
gplot(component.largest(g,connected="weak",result="graph"))
#Find strong components[强大的组件]
cd<-component.dist(g,connected="strong")
cd$membership #Who's in what component?[谁在什么成分?]
cd$csize #What are the component sizes?[组件的大小是什么?]
#Plot the size distribution[绘制的尺寸分布]
plot(1:length(cd$cdist),cd$cdist/sum(cd$cdist),ylim=c(0,1),type="h")
lgc<-component.largest(g,connected="strong") #Get largest component[最大的组成部分]
gplot(g,vertex.col=2+lgc) #Plot g, with component membership[图克,组件的成员]
#Plot largest component itself [图最大的组成部分本身]
gplot(component.largest(g,connected="strong",result="graph"))
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|