Skip to contents

Creates a visNetwork plot given a list of nodes and edges. The nodes data frame can be created with create_nodes_visnetwork; the edges with create_edges_visnetwork. In order to highlight edges, you can use set_attributes_to_edges_visnetwork.

Usage

visnetwork(
  nodes,
  edges,
  node_titles = nodes$id,
  title = "",
  igraph_layout = "layout_in_circle"
)

Arguments

nodes

A data frame with rows equal to the number of nodes with columns "id" and "title". Can be created with create_nodes_visnetwork.

edges

A data frame with columns "from" and "to. Each row represents an edge between two nodes (integer)

node_titles

Vector with title of the nodes (Default: 1:p)

title

A list with n_lambda_values vectors. Each vector is of the lenght m. Regulates the titles of the graphs (Default: no title)

igraph_layout

igraph layout (default: layout_in_circle)

Value

A visNetwork plot

See also

Examples

nodes <- create_nodes_visnetwork(n_nodes = 5, labels = LETTERS[1:5])

adj_matrix <- matrix(c(0, 1, 0, 1, 0,
                       1, 0, 1, 0, 0,
                       0, 1, 0, 0, 0,
                       1, 0, 0, 0, 1,
                       0, 0, 0, 1, 0), ncol = 5)

edges <- create_edges_visnetwork(adj_matrix)

shared_edges <- data.frame(from = c(1,2), to = c(4, 3))

edges <- set_attributes_to_edges_visnetwork(edges,
                                            subset_edges = shared_edges,
                                            width = c(3, .5),
                                            color = c("red", "blue"))

visnetwork(nodes, edges)