Learn R Programming

HyperG (version 1.0.0)

remove.redundant.vertices: Remove redundant vertices.

Description

Remove vertices whose removal does not disconnect the hypergraph.

Usage

remove.redundant.vertices(H, check.empty = TRUE)

Arguments

H

a hypergraph.

check.empty

logical. See details.

Value

a hypergraph.

Details

This function was created with a binary term document hypergraph in mind. The idea is to remove words that appear in large documents, in order of decreasing degree, so long as the removal does not disconnect the graph. The argument check.empty is to ensure that removing a word does not result in an empty document. If this is set to FALSE, the resultant hypergraph may be much smaller than expected.

Examples

Run this code
# NOT RUN {
  edges <- list(letters[c(1:4,9)],
					 letters[3:9],
					 letters[c(3,6:9)],
					 letters[c(3,5:9)],
					 letters[2:9])
  h1 <- hypergraph_from_edgelist(edges)
  h <- remove.redundant.vertices(h1)
  # removed c, f, g, i

  h2 <- hypergraph_from_edgelist(list(letters[1:3],
					  letters[3:5]))

  h <- remove.redundant.vertices(h2)
  ## h == h2
# }

Run the code above in your browser using DataLab