Learn R Programming

HyperG (version 1.0.0)

hypergraph.add.edges: Add edges or vertices to a hypergraph.

Description

Adds hyper-edges or vertices to a hypergraph.

Usage

hypergraph.add.edges(h, edges, verbose = FALSE)
add.hyperedges(h, edges, verbose = FALSE)
hypergraph.add.vertices(h, nv, names)

Arguments

h

A hypergraph.

edges

A list of edges to be added.

nv

Number of vertices to add.

names

Optional vector of names of the vertices.

verbose

logical. Whether to warn if new vertices are created.

Value

Returns a hypergraph (or graph) as appropriate.

Details

The edges can be indices or edge names. This is different than the graph call -- see the igraph package help for that. If edges is NULL, or missing, hypergraph.add.edges adds a single empty hyper-edge to the hypergraph. add.hyperedges is an alias for hypergraph.add.edges.

See Also

add_vertices, add_edges

Examples

Run this code
# NOT RUN {
   h <- hypergraph_from_edgelist(list(1:4,1:2,c(2,3,5),c(3,5:7)))
	h1 <- hypergraph.add.vertices(h,1,"8")
	h2 <- hypergraph.add.edges(h,list(c(1,5,8),7:9))
# }

Run the code above in your browser using DataLab