graphneigh(spdep)
graphneigh()所属R语言包:spdep
Graph based spatial weights
基于图的空间权重
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Functions return a graph object containing a list with the vertex coordinates and the to and from indices defining the edges. The helper function graph2nb converts a graph object into a neighbour list. The plot functions plot the graph objects.
函数返回一个图形对象,它包含一个列表的顶点坐标和指标定义的边缘。辅助函数graph2nb到邻居列表转换为图形对象。绘图功能绘制的图形对象。
用法----------Usage----------
gabrielneigh(coords, nnmult=3)
relativeneigh(coords, nnmult=3)
soi.graph(tri.nb, coords)
graph2nb(gob, row.names=NULL,sym=FALSE)
## S3 method for class 'Gabriel'
plot(x, show.points=FALSE, add=FALSE, linecol=par(col), ...)
## S3 method for class 'relative'
plot(x, show.points=FALSE, add=FALSE, linecol=par(col),...)
参数----------Arguments----------
参数:coords
matrix of region point coordinates
区域点的坐标矩阵
参数:nnmult
scaling factor for memory allocation, default 3; if higher values are required, the function will exit with an error; example below thanks to Dan Putler
比例因子的内存分配,默认为3,如果需要更高的价值,该函数将退出与下面的由于丹Putler的,例如错误
参数:tri.nb
a neighbor list created from tri2nb
创建tri2nb的邻居列表
参数:gob
a graph object created from any of the graph funtions
创建的任何的曲线funtions的一个图形对象
参数:row.names
character vector of region ids to be added to the neighbours list as attribute region.id, default seq(1, nrow(x))
字符区域的id被添加到向量的邻居列表的属性region.id,默认seq(1, nrow(x))
参数:sym
a logical argument indicating whether or not neighbors should be symetric (if i->j then j->i)
一个符合逻辑的论据,说明是否或不相邻应该是对称的(如果I-> J然后J-> I)
参数:x
object to be plotted
反对绘制
参数:show.points
(logical) add points to plot
(逻辑)加点来绘制
参数:add
(logical) add to existing plot
(逻辑)添加到现有的图
参数:linecol
edge plotting colour
边缘绘制颜色
参数:...
further graphical parameters as in par(..)
进一步的图形参数如par(..)
Details
详细信息----------Details----------
The graph functions produce graphs on a 2d point set that are all subgraphs of the Delaunay triangulation. The relative neighbor graph is defined by the relation, x and y are neighbors if
的图形函数产生一个2D点集的Delaunay三角网的所有子图的图形。的关系所定义的相对邻居图,x和y是邻居,如果
where d() is the distance, S is the set of points and z is an arbitrary point in S. The Gabriel graph is a subgraph of the delaunay triangulation and has the relative neighbor graph as a sub-graph. The relative neighbor graph is defined by the relation x and y are Gabriel neighbors if
其中d()的距离,S的点的集合和z中的任意点S.加布里埃尔图Delaunay三角网的一个子一个子图具有相对邻居图。由x和y的关系被定义的相对邻居图是加布里埃尔邻居,如果
where x,y,z and S are as before. The sphere of influence graph is defined for a finite point set S, let r_x be the distance from point x to its nearest neighbor in S, and C_x is the circle centered on x. Then x and y are SOI neigbors iff C_x and C_y intersect in at least 2 places.
其中,x,y,z和S是如前。被定义为一个有限点集S的影响图的领域,让r_x点x到距离其最近的邻居在S,和C_x是圆心在x。那么X和Y是SOI neigbors,当且仅当C_x和C_y中至少有2处相交。
See card for details of “nb” objects.
见card的“NB”对象的详细信息。
值----------Value----------
A list of class Graph withte following elements
类Graph的withte以下元素列表
参数:np
number of input points
输入点的数
参数:from
array of origin ids
阵列的起源IDS
参数:to
array of destination ids
阵列的目的地IDS
参数:nedges
number of edges in graph
图中的边缘的数目
参数:x
input x coordinates
输入x坐标
参数:y
input y coordinates
输入y坐标
The helper functions return an nb object with a list of integer vectors containing neighbour region number ids.
辅助函数返回一个nb对象的列表包含邻域数IDS的整数向量。
(作者)----------Author(s)----------
Nicholas Lewin-Koh <a href="mailto:nikko@hailmail.net">nikko@hailmail.net</a>
参考文献----------References----------
graphs relevant to geographic variation research and the clustering of points in the plane, Geographic Analysis, 12(3), pp. 205-222.
planar set, Pattern Recognition, 12(4), pp. 261-268.
computational morphology. In Computational Geometry, Ed. G. T. Toussaint, North Holland.
参见----------See Also----------
knearneigh, dnearneigh,
knearneigh,dnearneigh,
实例----------Examples----------
example(columbus)
coords <- coordinates(columbus)
par(mfrow=c(2,2))
col.tri.nb<-tri2nb(coords)
col.gab.nb<-graph2nb(gabrielneigh(coords), sym=TRUE)
col.rel.nb<- graph2nb(relativeneigh(coords), sym=TRUE)
col.soi.nb<- graph2nb(soi.graph(col.tri.nb,coords), sym=TRUE)
plot(columbus, border="grey")
plot(col.tri.nb,coords,add=TRUE)
title(main="Delaunay Triangulation")
plot(columbus, border="grey")
plot(col.gab.nb, coords, add=TRUE)
title(main="Gabriel Graph")
plot(columbus, border="grey")
plot(col.rel.nb, coords, add=TRUE)
title(main="Relative Neighbor Graph")
plot(columbus, border="grey")
plot(col.soi.nb, coords, add=TRUE)
title(main="Sphere of Influence Graph")
par(mfrow=c(1,1))
dx <- rep(0.25*0:4,5)
dy <- c(rep(0,5),rep(0.25,5),rep(0.5,5), rep(0.75,5),rep(1,5))
m <- cbind(c(dx, dx, 3+dx, 3+dx), c(dy, 3+dy, dy, 3+dy))
try(res <- gabrielneigh(m))
res <- gabrielneigh(m, nnmult=4)
summary(graph2nb(res))
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|