gg <- function(x,r=1,method=NULL,usedeldir=TRUE) { if(usedeldir){ if(!require(deldir,quietly=TRUE)) usedeldir <- FALSE } dx <- as.matrix(dist(x,method=method)) n <- nrow(dx) A <- matrix(0,nrow=n,ncol=n) if(is.vector(x)) x <- matrix(x,ncol=1) if(usedeldir && (method=="Euclidean" || is.null(method)) && (ncol(x)==2)){ del <- deldir(x[,1],x[,2]) for(edge in 1:nrow(del$delsgs)){ i <- del$delsgs[edge,5] j <- del$delsgs[edge,6] d1 <- r*dx[i,j]/2 d <- dist((x[i,,drop=FALSE]+x[j,,drop=FALSE])/2,x,method=method) d[i] <- Inf d[j] <- Inf if(!any(d