| add_edges | R Documentation |
Add Edges to a Network
add_edges(x, from, to, weight = 1, ..., keep_format = FALSE, directed = NULL)
x |
Network input. |
from |
Source nodes, by label or index. |
to |
Target nodes, by label or index. The same length as |
weight |
Numeric weight for the new edges, length 1 or
|
... |
Named vectors of extra edge attributes, length 1 or
|
keep_format |
Logical. Return the input format when TRUE. |
directed |
Logical or NULL. If NULL (default), auto-detect. |
A cograph_network with the new edges, or the input format
when keep_format = TRUE. An edge that already exists has its weight
replaced, and a cograph_edges_replaced warning says how many.
When the igraph package is attached it masks this function with
igraph::add_edges(), which takes an igraph object. Use
cograph::add_edges() to be explicit.
remove_edges, add_nodes,
bind_networks
adj <- matrix(0, 3, 3, dimnames = list(LETTERS[1:3], LETTERS[1:3]))
adj["A", "B"] <- adj["B", "A"] <- 1
add_edges(adj, from = "B", to = "C", weight = 0.5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.