Learn R Programming

HyperG (version 1.0.0)

epsilon_hypergraph: Epsilon-Ball Hypergraph

Description

Build a hypergraph by constructing hyperedges from balls around a set of points.

Usage

epsilon_hypergraph(x, epsilon, method = "Euclidean", reduce=FALSE, 
   as.graph=FALSE)

Arguments

x

a matrix of points.

epsilon

radius of the balls. May be a vector.

method

passed to dist to define the distance function.

reduce

logical. Whether to reduce the hypergraph by removing reduntant hyper-edges.

as.graph

logical. Whether to return a graph instead of a hypergraph.

Value

a hypergraph or graph.

Details

Each point of x corresponds to a vertex in the hypergraph. For each point, a ball of radius epsilon is constructed, and all points in the ball form a hyper-edge in the graph. If epsilon is a vector, each ball may have a different radius, and if the length of epsilon is less than the number of points, they are repeated.

If reduce=TRUE reduntant hyper-edges (those contained in other hyper-edges) are removed. If as.graph==TRUE, reduce is ignored an a graph is returned instead of a hypergraph.

See Also

knn_hypergraph, sample_geom_hypergraph, dist.

Examples

Run this code
# NOT RUN {
   set.seed(565)
	x <- matrix(rnorm(100),ncol=2)
	h <- epsilon_hypergraph(x,epsilon=.25)
	
# }
# NOT RUN {
	   plot(h)
		plot(h,layout=x)
	
# }
# NOT RUN {
	epsilons <- runif(nrow(x),0,.5)
	k <- epsilon_hypergraph(x,epsilon=epsilons)
	
# }
# NOT RUN {
	   plot(k)
		plot(k,layout=x)
	
# }

Run the code above in your browser using DataLab