hype_from_edge_list: Create a Hypergraph From a Hyperedge List

Description Usage Arguments Value Examples

View source: R/create_hypergraphs.R

Description

Create a Hypergraph From a Hyperedge List

Usage

1
hype_from_edge_list(elist, directed = FALSE)

Arguments

elist

A hyperedge list. For an unoriented hypergraph, a hyperedge is just a vector of the vertices contained within the hyperedge. Each vertex is represented as a string. For an oriented hypergraph, each hyperedge is itself a list of two vectors. Each of these vectors contains strings representing the vertices contained in one end of the hyperedge. For a directed hypergraph, each hyperedge is also a list of two vectors. In the directed case, the first vector represents the vertices contained in the tail of the hyperedge and the second the vertices contained in the head. These two entries are also named from and to.

directed

A logical value representing whether the hypergraph should be directed.

Value

A hypergraph object with the given hyperedge structure.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
l1 <- list(
  h1 = c("a", "b", "c"),
  h2 = c("c", "d", "e"),
  h3 = c("a", "e")
)
hype1 <- hype_from_edge_list(l1)

l2 <- list(
  h1 = list(
    c("a", "b"),
    c("b", "c")
  ),
  h2 = list(
    c("b", "c", "d"),
    c("e", "f")
  ),
  h3 = list(
    "f",
    "a"
  )
)
hype2 <- hype_from_edge_list(l2)
hype3 <- hype_from_edge_list(l2, directed = TRUE)

rhype documentation built on Nov. 9, 2021, 9:06 a.m.